| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace app\workerapi\logic;
- use app\common\logic\BaseLogic;
- use app\common\model\bank_account\BankAccount;
- use app\common\model\master_worker\MasterWorkerInfo;
- /**
- * @author 林海涛
- * @date 2024/7/10 下午4:29
- */
- class MasterWorkerInfoLogic extends BaseLogic
- {
- public static function changeIdCard($params,$userId)
- {
- try{
- $where = [['user_id', '=', $userId]];
- $userInfo = MasterWorkerInfo::where($where)->findOrEmpty();
- if ($userInfo->isEmpty()) {
- $userInfo = new MasterWorkerInfo();
- $userInfo->user_id = $userId;
- }
- $userInfo->real_name = $params['real_name'];
- $userInfo->id_card = $params['id_card'];
- $userInfo->id_card_front_img = $params['id_card_front_img'];
- $userInfo->id_card_opposite_img = $params['id_card_opposite_img'];
- $userInfo->save();
- return true;
- } catch(\Exception $e){
- self::setError($e->getMessage());
- return false;
- }
- }
- /**
- * 绑定银行卡
- * @param $params
- * @param $userId
- * @return bool
- * @author 林海涛
- * @date 2024/7/11 下午4:41
- */
- public static function bindBankAccount($params,$userId)
- {
- try{
- $where = [['worker_id', '=', $userId]];
- $bankAccount = BankAccount::where($where)->findOrEmpty();
- if ($bankAccount->isEmpty()) {
- $bankAccount = new BankAccount();
- $bankAccount->worker_id = $userId;
- }
- $bankAccount->account_holder = $params['account_holder'];
- $bankAccount->bank_name = $params['bank_name'];
- $bankAccount->province = $params['province'];
- $bankAccount->city = $params['city'];
- $bankAccount->opening_branch = $params['opening_branch'];
- $bankAccount->account = $params['account'];
- $bankAccount->mobile = $params['mobile'];
- $bankAccount->save();
- return true;
- } catch(\Exception $e){
- self::setError($e->getMessage());
- return false;
- }
- }
- }
|