zhaojs
2023-06-14 c83ddcedb77fa77cedaa9de5bc7253197f995ba1
application/api/controller/User.php
@@ -18,6 +18,8 @@
use app\api\logic\UserWithdrawal as LogicUserWithdrawal;
use app\api\logic\SettlementRecord as LogicSettlementRecord;
use app\api\logic\UserMoneyLog as LogicUserMoneyLog;
use think\log;
/**
 * 会员接口
 */
@@ -84,6 +86,7 @@
        $mobile = $this->request->post('mobile');
        $captcha = $this->request->post('captcha');
        $ismobouth=$this->request->post('ismobouth',false);
        $push_cid=$this->request->post('push_cid',false);
        if (!$mobile || !$captcha) {
            $this->error(__('Invalid parameters'));
        }
@@ -245,6 +248,7 @@
    {
        $openid = request()->param('openid');
        $access_token = request()->param('access_token');
        $push_cid=request()->param('push_cid','');
        $LogicUser = new LogicUser();
        $userId = $LogicUser->getUserByOpenId($openid);
        if ($userId) {
@@ -252,6 +256,10 @@
            if(empty($user)) $this->error("用户信息获取失败");
            if ($user['status'] != 'normal') {
                $this->error(__('Account is locked'));
            }
            if(!empty($push_cid)&&empty($user['push_cid']))
            {//表里push_cid为空,补全push_cid
            }
            //如果已经有账号则直接登录
            $ret = $this->auth->direct($user['id']);
@@ -431,6 +439,46 @@
    }
    /**
     * 标记浏览0元购商品记录
     *
     * @return void
     */
    public function update_first_free_browse()
    {
        $ids = request()->param('goodsid','');
        $new_goodsId = request()->param('new_goodsId','');
        $LogicUserBrowse = new LogicUserBrowse();
        $res = $LogicUserBrowse->updatefirstfreelog(USERID,$ids,$new_goodsId);
        if($res === false) $this->error($LogicUserBrowse->getError());
        $this->success([],'添加成功');
    }
    /**
     * 检测是否首单
     *
     * @return void
     */
    public function check_isfirst_free()
    {
        $LogicUserBrowse = new LogicUserBrowse();
        $res = $LogicUserBrowse->checkIsFirstFree(USERID);
        if($res === false) $this->error($LogicUserBrowse->getError());
        Log::write('检测是否首单:'.json_encode($res));
        if(empty($res)) $this->success(['info'=>1],'首单客户');
        $this->success(['info'=>0],'非首单客户');
    }
     /**
     * 用户收藏记录
     *