文件
mashangyoujiu/Application/Delivery/Controller/PosterApplyController.class.php

72 行
2.0 KiB
PHP
可执行文件

<?php
namespace Delivery\Controller;
use app\common\controller\Api;
/**
* 申请骑手
*/
class PosterApply extends BaseController
{
// 无需登录的接口,*表示全部
protected $noNeedLogin = [];
// 无需鉴权的接口,*表示全部
protected $noNeedRight = "*";
public function _initialize()
{
parent::_initialize();
}
/**
* 申请记录
*/
public function info(){
$posterApplyModel = new \app\admin\model\paotui\Posterapply();
$posterApply = $posterApplyModel
->alias("poster_apply")
->field("poster_apply.*")
->where(['poster_apply.user_id'=>$this->auth->id])->find();
$this->success("请求成功",$posterApply);
}
/**
* 提交申请
*/
public function submit(){
$name = $this->request->post("name");
$mobile = $this->request->post("mobile");
$card = $this->request->post("card");
$card_back = $this->request->post("card_back");
$hand_card = $this->request->post("hand_card","");
$posterApplyModel = new \app\admin\model\paotui\Posterapply();
$posterApply = $posterApplyModel->where(['user_id'=>$this->auth->id])->find();
if($posterApply){
if($posterApply['status'] != 1){
$posterApply->save([
'name'=>$name,
'mobile'=>$mobile,
'card'=>$card,
'card_back'=>$card_back,
'hand_card'=>$hand_card,
]);
}
}else{
$posterApplyModel = new \app\admin\model\paotui\Posterapply();
$posterApplyModel->save([
'user_id'=>$this->auth->id,
'name'=>$name,
'mobile'=>$mobile,
'card'=>$card,
'card_back'=>$card_back,
'hand_card'=>$hand_card
]);
}
$this->success("请求成功");
}
}