| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- namespace App\Models;
- /**
- *
- */
- class Pay_password extends BaseModel {
- protected $table = 'pay_password';
- public $timestamps = false;
- //更新
- function updateInfo($data, $aid) {
- $checkisset = $this->checkIsSet($aid);
- if($checkisset<0){
- $res = $this->addInfo($data,$aid);
- return $res;
- }
- $res = $this->where('account_identity', $aid)->update($data);
- if (!$res) {
- return -4010000202; //更新失败
- }
- return 1;
- }
-
- //添加用户支付密码
- function addInfo($data,$aid){
- $this->identity=UUID();
- $this->account_identity = $aid;
- $this->pay_password = $data['pay_password'];
- $this->encryption = $data['encryption'];
- $res = $this->save();
- if (!$res) {
- return -4010000302; //添加用户支付密码失败
- }
- return 1;
- }
-
- //验证用户是否设置支付密码
- function checkIsSet($aid){
- $res = $this->where('account_identity',$aid)->first();
- if(!$res){
- return -4010000402; //未设置支付密码
- }
- return 1;
- }
- }
- ?>
|