dataLists(new SystemStoreLists()); } /** * 门店信息 */ public function detail() { $store_id = (int)$this->request->get('store_id'); $phone = (int)$this->request->get('phone'); $where = []; if($phone){ $where['phone'] = $phone; } if($store_id){ $where['id'] = $store_id; } $info = StoreLogic::search($where); if ($info) { return $this->data($info?->toArray()); } else { return $this->fail('店铺不存在'); } } /** * 门店会员充值 */ public function recharge() { $params = (new UserValidate())->post()->goCheck('rechargeStoreMoney'); $auth_code = $this->request->post('auth_code'); //微信支付条码 $find=User::where('mobile',$params['mobile'])->find(); if(!$find){ $find=UserUserLogic::StoreAdd($params); } $data=[ 'store_id'=>$params['store_id'], 'uid'=>$find['id'], 'staff_id'=>0, 'order_id'=>getNewOrderId('CZ'), 'price'=>0.01, 'recharge_type'=>'INDUSTRYMEMBERS', ]; $order = UserRecharge::create($data); $order['pay_price']=$order['price']; $result = PaymentLogic::codepay($auth_code, $order,'条码支付'); if (PaymentLogic::hasError()) { return $this->fail(PaymentLogic::getError(), $params); } if (isset($result['trade_state_desc']) && $result['trade_state_desc'] == '支付成功') { PayNotifyLogic::handle('recharge', $result['out_trade_no'], $result); } else { Redis::send('send-code-pay', ['order_id' => $order['order_id'],'pay_type'=>'recharge']); return $this->success('用户支付中'); } return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id']]); } /** * 门店会员充值数量 */ public function recharge_count() { $store_id = $this->request->get('store_id',0); $count=0; if($store_id){ $count= UserRecharge::where(['store_id'=>$store_id,'recharge_type'=>'INDUSTRYMEMBERS','paid'=>1])->count(); } return $this->success('ok',['count'=>$count]); } }