Qc.php 4.9 KB

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