Qc.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <?php
  2. namespace app\api\controller;
  3. use think\cache\driver\Redis;
  4. use think\Db;
  5. use function Stringy\create;
  6. use app\common\library\Shande;
  7. use app\common\library\ShandeRapid;
  8. class Qc extends Base {
  9. public function index()
  10. {
  11. }
  12. public function cancelGoodsOrder(){
  13. $CancelTime = getCancelTime();
  14. if ($CancelTime<=0){
  15. die;
  16. }
  17. $redis = new Redis();
  18. $users = $redis->hkeys('buyUserInfo');
  19. if ($users){
  20. foreach ($users as &$value){
  21. $key = 'order_not_pay_'.$value;
  22. $len = $redis->hGetLen($key);
  23. if ($len){
  24. $list = $redis->hGetvals($key);
  25. foreach ($list as &$a){
  26. $info = json_decode($a,true);
  27. $cancel_time = strtotime($info['create_at'])+($CancelTime*60);
  28. if ($cancel_time<time()){
  29. $info['status'] = 2;
  30. $info['cancel_at'] = date('Y-m-d H:i:s');
  31. Db::name('store_order')->insert($info);
  32. //加上库存
  33. addCollectionInventory($info['c_id'],$info['num']);
  34. //减少用户购买数量
  35. DecrByCount($info['mid'],$info['c_id'],$info['num']);
  36. //删除数据
  37. $redis->hdel($key,$info['order_no']);
  38. }
  39. }
  40. }else{
  41. $redis->hdel('buyUserInfo',$value);
  42. }
  43. }
  44. }
  45. }
  46. public function refund()
  47. {
  48. $order_no = input('order_no');
  49. $money = input('money');
  50. $user_id = input('user_id');
  51. $is_new = input('is_new',0);
  52. $refund_no = $user_id ?$order_no.'S'.$user_id:$order_no;
  53. if($is_new) {
  54. (new ShandeRapid())->orderRefund($refund_no,$money);
  55. }else{
  56. (new Shande())->orderRefund($refund_no,$money);
  57. }
  58. }
  59. public function member()
  60. {
  61. $list = Db::name('store_member')->where('id',958)->field('id,invite_code,invite_address')->select();
  62. foreach ($list as $v) {
  63. $invite_address = getintiveaddress($v['invite_code']);
  64. Db::name('store_member')->where('id',$v['id'])->update(['invite_address'=>$invite_address]);
  65. }
  66. }
  67. public function yz()
  68. {
  69. $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"}';
  70. $data = json_decode($metaInfo,true);
  71. // $res = InitFaceVerify::main($data['name'],$data['id_no'],$data['MetaInfo'],$data['ReturnUrl']);
  72. $res = Certification::main($data['name'],$data['id_no'],$data['MetaInfo'],$data['ReturnUrl']);
  73. if(!$res) $this->error('初始化错误');
  74. $result = json_decode(json_encode($res),true)['body'];
  75. var_dump($result);
  76. if($result['code'] == 200) {
  77. $rc = Certification::check($result['resultObject']['certifyId']);
  78. $re2 = json_decode(json_encode($rc),true)['body'];
  79. var_dump($re2);
  80. }
  81. die();
  82. }
  83. public function index2()
  84. {
  85. $a = 1;
  86. switch ($a)
  87. {
  88. case 0:case 1:
  89. var_dump($a);
  90. break;
  91. case 2:
  92. var_dump($a);
  93. break;
  94. }
  95. die();
  96. $priority = checkMemberPriority(962,93);
  97. $by_num = getByCount(962,93);
  98. var_dump($by_num);
  99. die();
  100. $list = Db::name('store_order_info')
  101. ->where('mid',958)
  102. ->where('status','neq','2')
  103. ->where('is_destruction',1)
  104. ->where('resale_status',1)
  105. ->when($type,function ($query)use($type){ if($type) $query->where('type',$type);})
  106. ->field('id,tag,pro_info,resale_status,resale_price,type,is_destruction')
  107. ->order('id desc')
  108. ->select();
  109. die();
  110. die();
  111. $user_list = Db::name('store_member')->order('id asc')->limit(20)->column('id,name,phone');
  112. shuffle($user_list);
  113. var_dump( array_slice($user_list,0,3));
  114. var_dump($user_list);
  115. }
  116. public function redis()
  117. {
  118. $redis = new Redis();
  119. setMemberInfoHash($this->uid);
  120. $user_redis = getMemberInfoHash($this->uid);
  121. $this->success('',$user_redis);
  122. }
  123. }