UsersController.php 1.1 KB
<?php
/**
 * Created by PhpStorm.
 * User: ruidiudiu
 * Date: 2018/11/23
 * Time: 18:26
 */

namespace app\portal\controller;


use cmf\controller\HomeBaseController;
use think\Db;

class UsersController extends HomeBaseController{

    /**
     * @title 状态验证
     * @description 开锁前判断是否有未支付订单与是否提交押金
     * @author 董瑞恩
     * @url /portal/Aes/lock_check
     * @method GET
     *
     * @param name:users_id type:String require:1 default:无 other: desc:用户id
     */
    public function lock_check(){
        $users_id=$this->request->param('users_id');
        //获取提交押金的状态
        $users=Db::name('users')->where('id',$users_id)->find();
        if ($users['is_deposit']===1){
            $order=Db::name('order')->where(['users_id'=>$users_id,'state'=>1])->find();
            if (empty($order)){
                $this->apiResponse(200,'验证通过');
            }else{
                $this->apiResponse(302,'有未支付订单');
            }
        }else{
            $this->apiResponse(301,'未支付押金');
        }
    }
}