微信公众号绑定
This commit is contained in:
parent
3c8b0c56bb
commit
e60a160bcf
@ -4,10 +4,11 @@ namespace app\api\controller;
|
||||
|
||||
use app\api\logic\LoginLogic;
|
||||
use app\api\validate\{LoginAccountValidate, RegisterValidate, WebScanLoginValidate, WechatLoginValidate};
|
||||
use app\common\model\user\UserAuth;
|
||||
|
||||
class LoginController extends BaseApiController
|
||||
{
|
||||
public $notNeedLogin = ['account','logout','mnpLogin'];
|
||||
public $notNeedLogin = ['account','logout','mnpLogin','OaAuthBind'];
|
||||
|
||||
/**
|
||||
* @notes 账号登录
|
||||
@ -78,4 +79,22 @@ class LoginController extends BaseApiController
|
||||
LoginLogic::updateUser($params, $this->userId);
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 公众号授权绑定
|
||||
*/
|
||||
public function OaAuthBind(){
|
||||
$params=$this->request->post();
|
||||
if($params){
|
||||
$find=UserAuth::where('user_id',$params['uid'])->where('terminal',2)->find();
|
||||
if(!$find){
|
||||
UserAuth::create([
|
||||
'user_id'=>$params['uid'],
|
||||
'terminal'=>2,
|
||||
'openid'=>$params['openid'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -222,4 +222,19 @@ class RetailOrderController extends BaseApiController
|
||||
return $this->fail('确认失败');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 再次购买
|
||||
*/
|
||||
public function purchase_again(){
|
||||
$order_id = (int)$this->request->get('order_id');
|
||||
|
||||
$res=RetailOrderLogic::purchaseAgain($order_id);
|
||||
if($res==false){
|
||||
return $this->fail('添加失败');
|
||||
}else{
|
||||
return $this->success('添加成功');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -128,4 +128,23 @@ class RetailOrderLogic extends BaseLogic
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function purchaseAgain($order_id){
|
||||
$arr= Cashierinfo::where('pid',$order_id)->field('goods,nums')->select();
|
||||
$data=[];
|
||||
foreach ($arr as $k=>$v){
|
||||
$data[$k]['goods_id']=$v['goods'];
|
||||
$data[$k]['cart_num']=$v['nums'];
|
||||
$data[$k]['uid']=Request()->userId;
|
||||
$data[$k]['source']=0;
|
||||
$data[$k]['mer_id']=0;
|
||||
$data[$k]['staff_id']=0;
|
||||
$data[$k]['is_new']=0;
|
||||
}
|
||||
if($data){
|
||||
( new Cart())->saveAll($data);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user