|
@@ -17,6 +17,7 @@ use app\services\user\UserAwardIntegralServices;
|
|
|
use app\services\user\UserServices;
|
|
|
use app\services\wechat\WechatUserServices;
|
|
|
use crmeb\services\CacheService;
|
|
|
+use crmeb\services\WithdrawService;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -305,6 +306,39 @@ class UserController
|
|
|
|
|
|
public function addEmployee(Request $request)
|
|
|
{
|
|
|
+ $user = $this->services->get($request->uid());
|
|
|
+ list($name, $id_card, $bank_code, $mobile, $front_image, $back_image) = $request->postMore([
|
|
|
+ ['name', ''],
|
|
|
+ ['id_card', ''],
|
|
|
+ ['bank_code', ''],
|
|
|
+ ['mobile', ''],
|
|
|
+ ['front_image', ''],
|
|
|
+ ['back_image', ''],
|
|
|
+ ], true);
|
|
|
+ if ($user['enterprise_professional_facilitator_id']) {
|
|
|
+ $bank_info = WithdrawService::init()::contractInfo($user['enterprise_professional_facilitator_id']);
|
|
|
+ return app('json')->success('已添加用户', ["enterprise_professional_facilitator_id" => $user['enterprise_professional_facilitator_id'],
|
|
|
+ "professional_id" => $user['professional_id'], 'info' => $bank_info]);
|
|
|
+ } else {
|
|
|
+ $res = WithdrawService::init()::addEmployee($name, $id_card, $bank_code, $mobile, $front_image, $back_image);
|
|
|
+ $this->services->update($request->uid(), ["enterprise_professional_facilitator_id" => $res['enterprise_professional_facilitator_id'],
|
|
|
+ "professional_id" => $res['professional_id']]);
|
|
|
+ return app('json')->success('已添加用户', $res);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
+ public function applySignUrl(Request $request)
|
|
|
+ {
|
|
|
+ $user = $this->services->get($request->uid());
|
|
|
+ if ($user['professional_id']) {
|
|
|
+ $bank_info = WithdrawService::init()::contractInfo($user['enterprise_professional_facilitator_id']);
|
|
|
+ if ($bank_info['is_contract']) {
|
|
|
+ return app('json')->fail('签约已完成');
|
|
|
+ }
|
|
|
+ return app('json')->success('ok', WithdrawService::init()::applySignUrl($user['professional_id']));
|
|
|
+ } else {
|
|
|
+ return app('json')->fail('请先添加收款信息');
|
|
|
+ }
|
|
|
}
|
|
|
}
|