Qc.php 4.9 KB

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