...
|
...
|
@@ -236,8 +236,8 @@ class Person extends Api |
|
|
if($data){
|
|
|
$this->error('不能重复绑定');
|
|
|
}
|
|
|
$data = $bank::create(['uid'=>$this->user_id,'bank_num'=>$bank_num,'open_bank'=>$open_bank]);
|
|
|
if($data){
|
|
|
$data1 = $bank::create(['uid'=>$this->user_id,'bank_num'=>$bank_num,'open_bank'=>$open_bank]);
|
|
|
if($data1){
|
|
|
$this->success('保存成功');
|
|
|
}else{
|
|
|
$this->error('保存失败');
|
...
|
...
|
@@ -248,6 +248,76 @@ class Person extends Api |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiTitle (银行卡列表)
|
|
|
* @ApiSummary (银行卡列表)
|
|
|
* @ApiMethod (GET)
|
|
|
* @ApiRoute (/api/person/bankList)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiReturn ([
|
|
|
{
|
|
|
"id": 3,//银行卡id
|
|
|
"bank_num": "6228480028807779179",//银行卡号
|
|
|
"open_bank": "农业银行"//开户行
|
|
|
},
|
|
|
{
|
|
|
"id": 7,
|
|
|
"bank_num": "6228480028306448000",
|
|
|
"open_bank": "open_bank"
|
|
|
}
|
|
|
])
|
|
|
*/
|
|
|
public function bankList(){
|
|
|
if($this->request->isGet()){
|
|
|
$data = Db::table('gc_bank')
|
|
|
->where(['uid'=>$this->user_id])
|
|
|
->field('id,bank_num,open_bank')
|
|
|
->select();
|
|
|
$this->success('成功', $data);
|
|
|
}else{
|
|
|
$this->error('请求方式错误');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiTitle (修改银行卡)
|
|
|
* @ApiSummary (修改银行卡)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiRoute (/api/person/updateBank)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiReturn ({
|
|
|
"code": 1,
|
|
|
"msg": "修改成功",
|
|
|
"time": "1555652055",
|
|
|
"data": null
|
|
|
})
|
|
|
*/
|
|
|
public function updateBank(){
|
|
|
if($this->request->isPost()) {
|
|
|
$id = $this->request->post('id');//银行卡id
|
|
|
$bank_num = $this->request->post('bank_num');//银行卡号
|
|
|
$open_bank = $this->request->post('open_bank');//开户行
|
|
|
$rule = config('site.update_bank');
|
|
|
$validate = new Validate($rule['rule'],$rule['msg']);
|
|
|
if (!$validate->check(['id'=>$id,'bank_num'=>$bank_num,'open_bank'=>$open_bank])) {
|
|
|
$this->error($validate->getError());
|
|
|
}
|
|
|
$data = Db::table('gc_bank')->where('id','neq',$id)->where(['uid'=>$this->user_id,'bank_num'=>$bank_num])->find();
|
|
|
if($data){
|
|
|
$this->error('此银行卡已绑定');
|
|
|
}
|
|
|
$bank = new Bank();
|
|
|
$data1 = $bank->where(['id'=>$id,'uid'=>$this->user_id])->update(['open_bank'=>$open_bank,'bank_num'=>$bank_num]);
|
|
|
if($data1){
|
|
|
$this->success('修改成功');
|
|
|
}else{
|
|
|
$this->error('修改失败');
|
|
|
}
|
|
|
}else{
|
|
|
$this->error('请求方式错误');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据规则增加积分
|
|
|
* @param $share_uid
|
|
|
* @param $type
|
...
|
...
|
|