初始化项目:添加后端代码、ThinkPHP框架、前端资源
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller\app\agent;
|
||||
|
||||
use app\common\controller\Api;
|
||||
|
||||
/**
|
||||
* 提现银行卡
|
||||
*/
|
||||
class WithdrawCard extends Api
|
||||
{
|
||||
|
||||
protected $noNeedLogin = [];
|
||||
// 无需鉴权的接口,*表示全部
|
||||
protected $noNeedRight = ['*'];
|
||||
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
\app\common\model\fill\Handle::check('app_config','agent');
|
||||
$this->model = new \app\api\model\app\agent\WithdrawCard();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取银行卡信息
|
||||
* @return void
|
||||
*/
|
||||
public function getCard(){
|
||||
$data = $this->model->getCard($this->auth->id);
|
||||
|
||||
$this->success('获取成功', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置银行卡信息
|
||||
* @return void
|
||||
*/
|
||||
public function setCard(){
|
||||
$params = [];
|
||||
$params['name'] = $this->request->post('name');
|
||||
$params['card_no'] = $this->request->post('card_no');
|
||||
$params['address'] = $this->request->post('address');
|
||||
|
||||
|
||||
if(in_array("",$params)){
|
||||
$this->error("请完善表单后再提交");
|
||||
}
|
||||
|
||||
$params['updatetime'] = time();
|
||||
|
||||
$data = $this->model->getCard($this->auth->id);
|
||||
|
||||
if($data){
|
||||
$ret = $this->model->where([
|
||||
'user_id'=>$this->auth->id
|
||||
])->update($params);
|
||||
}else{
|
||||
$params['user_id'] = $this->auth->id;
|
||||
$params['uniacid'] = UNIACID;
|
||||
|
||||
$ret = $this->model->insert($params);
|
||||
}
|
||||
|
||||
if($ret){
|
||||
$this->success('设置成功');
|
||||
}
|
||||
|
||||
$this->error('设置失败,请重试');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user