This commit is contained in:
mkm 2024-06-25 16:05:38 +08:00
commit 7420769c9c
4 changed files with 33 additions and 19 deletions

View File

@ -42,7 +42,6 @@ class StoreController extends BaseApiController
{
$store_id = (int)$this->request->get('store_id');
$phone = (int)$this->request->get('phone');
$code = $this->request->get('code','');
$where = [];
if($phone){
$where['phone'] = $phone;
@ -50,17 +49,6 @@ class StoreController extends BaseApiController
if($store_id){
$where['id'] = $store_id;
}
if($code && $phone){
$remark = $phone.'_reporting';
$codeCache = Cache::get($remark);
if(empty($codeCache)){
return $this->fail('验证码不存在');
}
if ($codeCache != $code) {
return $this->fail('验证码错误');
}
}
$info = StoreLogic::search($where);
if ($info) {
return $this->success('ok',$info);
@ -77,6 +65,18 @@ class StoreController extends BaseApiController
$params = (new UserValidate())->post()->goCheck('rechargeStoreMoney');
$auth_code = $this->request->post('auth_code'); //微信支付条码
$recharge_type = $this->request->post('recharge_type',''); //微信支付条码
$code = $this->request->post('code','');//验证码
$phone = $params['mobile'];
if($code && $phone){
$remark = $phone.'_reporting';
$codeCache = Cache::get($remark);
if(empty($codeCache)){
return $this->fail('验证码不存在');
}
if ($codeCache != $code) {
return $this->fail('验证码错误');
}
}
$find=User::where('mobile',$params['mobile'])->find();
if(!$find){
$params['create_uid']=$this->userId;

View File

@ -4,6 +4,7 @@ namespace app\api\controller\user;
use app\api\controller\BaseApiController;
use app\api\logic\user\UserLogic;
use app\api\service\UserTokenService;
use app\api\validate\UserValidate;
use app\common\enum\PayEnum;
use app\common\logic\PaymentLogic;
@ -38,7 +39,14 @@ class UserController extends BaseApiController
if ($result === false) {
return $this->fail(UserLogic::getError());
}
if($result && is_numeric($result)){
$data = UserLogic::info($result);
$userInfo = UserTokenService::setToken($result, 1);
$data['token'] = $userInfo['token'];
}else{
$data = UserLogic::info($this->userId);
}
return $this->success('绑定成功', $data, 1, 1);
}
@ -165,7 +173,7 @@ class UserController extends BaseApiController
$params = (new UserValidate())->post()->goCheck('login');
$res = (new UserLogic())->dealReportingSms($params['account']);
if ($res){
return $this->success('发送成功');
return $this->success('发送成功',[],1,1);
}
return $this->fail('发送失败');

View File

@ -81,16 +81,22 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
$this->searchWhere[] = ['cate_id', '=', $class_all];
}
}
$field = 'id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch';
$order = $this->request->get('order','');
$field = $this->request->get('field','');
if(empty($order)||empty($field)){
$order = $this->sortOrder;
}else{
$order = [$field => $order];
}
$fields = 'id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch';
$this->searchWhere[] = ['status', '=', 1];
$this->searchWhere[] = ['stock', '>', 0];
return StoreBranchProduct::where($this->searchWhere)
->field($field)
->field($fields)
->with(['className', 'unitName'])
->limit($this->limitOffset, $this->limitLength)
->order($this->sortOrder)
->order($order)
// ->page($this->limitOffset +1,$this->limitLength)
->select()->toArray();
}

View File

@ -60,7 +60,7 @@ class UserLogic extends BaseLogic
UserAuth::where('user_id',$params['user_id'])->update([
'user_id'=>$user['id']
]);
User::destroy($params['user_id']);
return $user['id'];
// throw new \Exception('手机号已被其他账号绑定');
}