紧急修复接口
This commit is contained in:
parent
dc130190d3
commit
a57282c551
@ -3,9 +3,13 @@
|
|||||||
namespace app\api\controller;
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
|
||||||
|
use app\adminapi\validate\CompanyValidate;
|
||||||
|
use app\common\logic\contract\ContractLogic;
|
||||||
use app\common\logic\finance\ShareProfit;
|
use app\common\logic\finance\ShareProfit;
|
||||||
|
use app\common\logic\RedisLogic;
|
||||||
use app\common\logic\task\TaskLogic;
|
use app\common\logic\task\TaskLogic;
|
||||||
use app\common\model\Company;
|
use app\common\model\Company;
|
||||||
|
use app\common\model\contract\Contract;
|
||||||
use app\common\model\task\Task;
|
use app\common\model\task\Task;
|
||||||
use app\common\model\task_scheduling\TaskScheduling;
|
use app\common\model\task_scheduling\TaskScheduling;
|
||||||
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
||||||
@ -20,7 +24,19 @@ use app\common\model\contract\ShopContract;
|
|||||||
|
|
||||||
class CeshiController extends BaseApiController
|
class CeshiController extends BaseApiController
|
||||||
{
|
{
|
||||||
public array $notNeedLogin = ['index', 'ceshi', 'ceshi1', 'ceshi2', 'service_group_task_add_test', 'service_group_task_settlement_test', 'town_task_add_ceshi', 'town_task_settlement_ceshi'];
|
public array $notNeedLogin = [ 'index',
|
||||||
|
'ceshi',
|
||||||
|
'ceshi1',
|
||||||
|
'ceshi2',
|
||||||
|
'service_group_task_add_test', // 小组服务任务下发
|
||||||
|
'service_group_task_settlement_test', // 小组服务任务结算
|
||||||
|
'town_task_add_ceshi', // 镇农科任务下发
|
||||||
|
'town_task_settlement_ceshi', // 镇农科任务结算
|
||||||
|
'authentication', // 企业认证
|
||||||
|
'initiate_contract', // 发起合同
|
||||||
|
'Draftingcontracts', // 发送合同
|
||||||
|
'postsms', // 发送短信
|
||||||
|
];
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{ //1201
|
{ //1201
|
||||||
@ -121,29 +137,110 @@ class CeshiController extends BaseApiController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务刷新
|
* 企业认证
|
||||||
*/
|
*/
|
||||||
public function ceshi(){
|
public function authentication()
|
||||||
$time=strtotime(date('Y-m-d'));
|
{
|
||||||
// $time=strtotime(date('Y-m-d'));
|
$params = (new CompanyValidate())->goCheck('detail');
|
||||||
// $tiem_end=$time+86399;where('cron_time','<',$time)->
|
$company = Db::name('company')->where('id', $params['id'])->find();
|
||||||
$plan_all=TaskScheduling::where('id',8)->with('company_info')->select()->toArray();
|
$qualification = json_decode($company['qualification'], true);
|
||||||
foreach($plan_all as $k=>$v){
|
if ($company && $qualification['business_license']) {
|
||||||
$all=TaskTemplate::where('status',1)->where('task_scheduling',$v['id'])->limit(30)->select()->toArray();
|
$data = [
|
||||||
if($all){
|
'name' => $company['company_name'],
|
||||||
$plan_all[$k]['template']=$all;
|
'organization_code' => $company['organization_code'],
|
||||||
}else{
|
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png', //$qualification['business_license'],
|
||||||
unset($plan_all[$k]);
|
'master_name' => $company['master_name'],
|
||||||
|
'master_email' => $company['master_email'],
|
||||||
|
'master_phone' => $company['master_phone'],
|
||||||
|
'master_id_card' => $company['master_id_card'],
|
||||||
|
'id' => $company['id'],
|
||||||
|
];
|
||||||
|
$res = app(JunziqianController::class)->EnterpriseCertification($data);
|
||||||
|
Log::info(['企业认证同步结果',$res]);
|
||||||
|
if ($res->success == true) {
|
||||||
|
// 企业人脸上传
|
||||||
|
// $company['master_email'] = $email; // 法人邮箱
|
||||||
|
// $faceCreateRe = CompanyLogic::originationFaceCreate($company);
|
||||||
|
// if ($faceCreateRe !== true) {
|
||||||
|
// return $this->fail($faceCreateRe);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
if ($company['company_type'] == 30) {
|
||||||
|
// 平台公司不用初始化生成合同 合同签约暂不用人脸识别,预留人脸采集状态为已采集
|
||||||
|
Db::name('company')->where('id', $params['id'])->update([ 'is_contract'=>1,'face_create_status'=>1]);
|
||||||
|
} else {
|
||||||
|
Db::name('company')->where('id', $params['id'])->update([ 'face_create_status'=>1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加入缓存中,is_callback用于判断是否获取到异步通知
|
||||||
|
RedisLogic::getInstance()->set('authentication_company_id_'.$company['id'], json_encode(['company_id'=>$company['id'],'is_callback'=>0, 'timing'=>time()]));
|
||||||
|
// return $this->success('认证成功',[],1, 1);
|
||||||
|
return $this->success('系统认证中,请稍后刷新页面查看', ['email' => $res->data], 1, 1);
|
||||||
|
} else {
|
||||||
|
return $this->fail($res->msg);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return $this->fail("公司不存在");
|
||||||
}
|
}
|
||||||
$company_id=[];
|
}
|
||||||
foreach($plan_all as $k=>$v){
|
|
||||||
foreach($v['template'] as $kk=>$vv){
|
/**发起合同
|
||||||
TaskLogic::CronAdd($vv,$v);
|
* 请求参数如下
|
||||||
}
|
* id: 14
|
||||||
$company_id[]=$v['company_id'];
|
* party_a: 13
|
||||||
|
* party_a_name: 史丹利农业集团股份有限公司
|
||||||
|
* party_b: 14
|
||||||
|
* party_b_name: 中国乐凯集团有限公司
|
||||||
|
* contract_type: 25
|
||||||
|
* contract_no:
|
||||||
|
*/
|
||||||
|
public function initiate_contract()
|
||||||
|
{
|
||||||
|
$params = $this->request->param();
|
||||||
|
if (isset($params['party_a']) && $params['party_a'] > 0) {
|
||||||
|
$params['party_a'] = $params['party_a'];
|
||||||
|
} else {
|
||||||
|
$params['party_a'] = $this->adminInfo['company_id'];
|
||||||
|
}
|
||||||
|
$area_manager = Company::where('id', $params['party_a'])->value('area_manager');
|
||||||
|
$params['area_manager'] = $area_manager;
|
||||||
|
$params['type'] = 1;
|
||||||
|
$params['party_b'] = $params['id'];
|
||||||
|
unset($params['id']);
|
||||||
|
$result = ContractLogic::initiate_contract($params);
|
||||||
|
if (!empty($result) && $result['code'] == 1) {
|
||||||
|
return $this->success($result['msg'], $result['data'], 1, 1);
|
||||||
|
}
|
||||||
|
return $this->fail(ContractLogic::getError());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 发送合同 发送君子签签约请求,成功后会发送回短信
|
||||||
|
* id: 14
|
||||||
|
* contract_id: 14
|
||||||
|
*/
|
||||||
|
public function Draftingcontracts()
|
||||||
|
{
|
||||||
|
$params = $this->request->param();
|
||||||
|
$result = ContractLogic::Draftingcontracts($params);
|
||||||
|
if ($result == true) {
|
||||||
|
return $this->success('发送合同成功', [], 1, 1);
|
||||||
|
}
|
||||||
|
return $this->fail(ContractLogic::getError());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**发送短信
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function postsms()
|
||||||
|
{
|
||||||
|
$params = (new CompanyValidate())->goCheck('detail');
|
||||||
|
$id = Contract::where('party_b', $params['id'])->value('id');
|
||||||
|
$res = ContractLogic::postsms(['id' => $id]);
|
||||||
|
if ($res == true) {
|
||||||
|
return $this->success('发送成功', [], 1, 1);
|
||||||
|
} else {
|
||||||
|
return $this->fail(ContractLogic::getError());
|
||||||
}
|
}
|
||||||
Company::where('id','in',$company_id)->inc('day_count')->update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user