Pay_password.php 985 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace App\Models;
  3. /**
  4. *
  5. */
  6. class Pay_password extends BaseModel {
  7. protected $table = 'pay_password';
  8. public $timestamps = false;
  9. //更新
  10. function updateInfo($data, $aid) {
  11. $checkisset = $this->checkIsSet($aid);
  12. if($checkisset<0){
  13. $res = $this->addInfo($data,$aid);
  14. return $res;
  15. }
  16. $res = $this->where('account_identity', $aid)->update($data);
  17. if (!$res) {
  18. return -4010000202; //更新失败
  19. }
  20. return 1;
  21. }
  22. //添加用户支付密码
  23. function addInfo($data,$aid){
  24. $this->identity=UUID();
  25. $this->account_identity = $aid;
  26. $this->pay_password = $data['pay_password'];
  27. $this->encryption = $data['encryption'];
  28. $res = $this->save();
  29. if (!$res) {
  30. return -4010000302; //添加用户支付密码失败
  31. }
  32. return 1;
  33. }
  34. //验证用户是否设置支付密码
  35. function checkIsSet($aid){
  36. $res = $this->where('account_identity',$aid)->first();
  37. if(!$res){
  38. return -4010000402; //未设置支付密码
  39. }
  40. return 1;
  41. }
  42. }
  43. ?>