UserIdcards.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types = 1);
  12. namespace app\api\model\user;
  13. use app\api\service\User as UserService;
  14. use app\common\model\user\UserIdcards as UserIdcardsModel;
  15. /**
  16. * 用户认证
  17. * Class Delivery
  18. * @package app\common\model
  19. */
  20. class UserIdcards extends UserIdcardsModel
  21. {
  22. /**
  23. * 新增or更新
  24. * @param $param
  25. * @throws \app\common\exception\BaseException
  26. * @throws \think\db\exception\DataNotFoundException
  27. * @throws \think\db\exception\DbException
  28. * @throws \think\db\exception\ModelNotFoundException
  29. */
  30. public function addOne($param){
  31. $userId = UserService::getCurrentLoginUserId();
  32. $m = self::where(['user_id'=>$userId])->find()? : new self();
  33. $m->save(['user_id'=>$userId,'id_card'=>$param['id_card'],'real_name'=>$param['real_name']]);
  34. }
  35. }