123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <?php
- namespace app\api\controller;
- use think\cache\driver\Redis;
- use think\Db;
- use function Stringy\create;
- use app\common\library\Shande;
- use app\common\library\ShandeRapid;
- class Qc extends Base {
- public function index()
- {
- }
- public function cancelGoodsOrder(){
- $CancelTime = getCancelTime();
- if ($CancelTime<=0){
- die;
- }
- $redis = new Redis();
- $users = $redis->hkeys('buyUserInfo');
- if ($users){
- foreach ($users as &$value){
- $key = 'order_not_pay_'.$value;
- $len = $redis->hGetLen($key);
- if ($len){
- $list = $redis->hGetvals($key);
- foreach ($list as &$a){
- $info = json_decode($a,true);
- $cancel_time = strtotime($info['create_at'])+($CancelTime*60);
- if ($cancel_time<time()){
- $info['status'] = 2;
- $info['cancel_at'] = date('Y-m-d H:i:s');
- Db::name('store_order')->insert($info);
- //加上库存
- addCollectionInventory($info['c_id'],$info['num']);
- //减少用户购买数量
- DecrByCount($info['mid'],$info['c_id'],$info['num']);
- //删除数据
- $redis->hdel($key,$info['order_no']);
- }
- }
- }else{
- $redis->hdel('buyUserInfo',$value);
- }
- }
- }
- }
- public function refund()
- {
- $order_no = input('order_no');
- $money = input('money');
- $user_id = input('user_id');
- $is_new = input('is_new',0);
- $refund_no = $user_id ?$order_no.'S'.$user_id:$order_no;
- if($is_new) {
- (new ShandeRapid())->orderRefund($refund_no,$money);
- }else{
- (new Shande())->orderRefund($refund_no,$money);
- }
- }
- public function member()
- {
- $list = Db::name('store_member')->where('id',958)->field('id,invite_code,invite_address')->select();
- foreach ($list as $v) {
- $invite_address = getintiveaddress($v['invite_code']);
- Db::name('store_member')->where('id',$v['id'])->update(['invite_address'=>$invite_address]);
- }
- }
- public function yz()
- {
- $metaInfo ='{"name":"任锐","id_no":"511323199311211933","MetaInfo":"{\"bioMetaInfo\":\"4.1.0:2916352,0\",\"deviceType\":\"h5\",\"ua\":\"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1\"}","ReturnUrl":"http%3A%2F%2Flocalhost%3A8080%2Fh5%2Fpages%2Fmine%2Frenzheng"}';
- $data = json_decode($metaInfo,true);
- // $res = InitFaceVerify::main($data['name'],$data['id_no'],$data['MetaInfo'],$data['ReturnUrl']);
- $res = Certification::main($data['name'],$data['id_no'],$data['MetaInfo'],$data['ReturnUrl']);
- if(!$res) $this->error('初始化错误');
- $result = json_decode(json_encode($res),true)['body'];
- var_dump($result);
- if($result['code'] == 200) {
- $rc = Certification::check($result['resultObject']['certifyId']);
- $re2 = json_decode(json_encode($rc),true)['body'];
- var_dump($re2);
- }
- die();
- }
- public function index2()
- {
- $a = 1;
- switch ($a)
- {
- case 0:case 1:
- var_dump($a);
- break;
- case 2:
- var_dump($a);
- break;
- }
- die();
- $priority = checkMemberPriority(962,93);
- $by_num = getByCount(962,93);
- var_dump($by_num);
- die();
- $list = Db::name('store_order_info')
- ->where('mid',958)
- ->where('status','neq','2')
- ->where('is_destruction',1)
- ->where('resale_status',1)
- ->when($type,function ($query)use($type){ if($type) $query->where('type',$type);})
- ->field('id,tag,pro_info,resale_status,resale_price,type,is_destruction')
- ->order('id desc')
- ->select();
- die();
- die();
- $user_list = Db::name('store_member')->order('id asc')->limit(20)->column('id,name,phone');
- shuffle($user_list);
- var_dump( array_slice($user_list,0,3));
- var_dump($user_list);
- }
- public function redis()
- {
- $redis = new Redis();
- setMemberInfoHash($this->uid);
- $user_redis = getMemberInfoHash($this->uid);
- $this->success('',$user_redis);
- }
- }
|