User.php 987 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace app\api\model\taxi;
  3. use app\common\model\BaseModel;
  4. class User extends BaseModel
  5. {
  6. protected $name = 'taxi_user';
  7. protected $insert = ['status' => 3,'remark' => '用户申请','created_at','updated_at'];
  8. protected $update = ['updated_at'];
  9. public function getIdCardImgAttr($value, $data)
  10. {
  11. if (isset($data['id_card_img']) && $data['id_card_img']) {
  12. $array = [];
  13. $idCardImg = json_decode($data['id_card_img'], true);
  14. foreach ($idCardImg as $item) {
  15. $array[] = [
  16. 'url' => $item
  17. ];
  18. }
  19. return $array;
  20. }
  21. return [];
  22. }
  23. public function setIdCardImgAttr($value, $data)
  24. {
  25. if (isset($data['id_card_img']) && $data['id_card_img']) {
  26. $array = explode(',', $data['id_card_img']);
  27. return json_encode($array);
  28. }
  29. return [];
  30. }
  31. }