WokerTask/app/api/controller/CeshiController.php

723 lines
32 KiB
PHP
Raw Normal View History

2023-12-27 14:06:33 +08:00
<?php
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\RedisLogic;
use app\common\logic\ShopRequestLogic;
use app\common\logic\task\TaskLogic;
use app\common\model\Company;
use app\common\model\contract\Contract;
use app\common\model\task\Task;
use app\common\model\task_scheduling\TaskScheduling;
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
use app\common\model\task_template\TaskTemplate;
use app\job\TaskAdd;
use app\job\TaskInformationJob;
use app\job\VillageTaskAdd;
use app\job\VillageTaskSettlementJob;
use think\Exception;
use think\facade\Log;
use app\job\TaskTenZehn;
use think\facade\Db;
use app\common\model\ShopMerchant;
use app\common\model\contract\ShopContract;
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', // 镇农科任务结算
'authentication', // 企业认证
'initiate_contract', // 发起合同
'Draftingcontracts', // 发送合同
'postsms', // 发送短信
'addSupplyMerchant', // 添加供应商
'signSupplyMerchantContract', // 生成合同
'countRate',
'village_task_add_test',
'village_task_settlement_test',
'testShopApi'
];
public function index()
{ //1201
$id = 9;
$shopMerchant = ShopMerchant::find(['id', $id]);
// $data=json_decode($parmas['data'],true);
// if($data['status']==1){
// if($data['organizationRegNo']!=$shopMerchant->organization_code){
// Log::error(['认证回调错误:',$parmas]);
// return json(['success' => false, 'msg' => '认证回调错误']);
// }
$shopMerchant->save(['is_authentication' => 1]);
// 生成合同
$createContractData = [
'id' => $id,
'party_a' => 1,
'party_a_name' => '泸州市海之农科技有限公司',
'party_b' => $id,
'party_b_name' => $shopMerchant->company_name,
'contract_type' => 22,
];
$model = new ShopContract();
$model->contract_no = time();
$model->create_time = time();
$model->check_status = 1;
$model->update_time = time();
$model->setAttrs($createContractData);
$res = $model->save($createContractData);
// }
halt($res);
$select = Db::name('company_form')->where('type', 0)
->select();
$id = 0;
foreach ($select as $key => $value) {
$id = $value['id'];
if ($value['organization_code'] != '' || $value['organization_code'] != null) {
// $pattern = "/\*/";
$name = $value['master_name'];
// if(preg_match($pattern, $name)){
// $name=$value['master_name'];
// }
// if ($value['master_email']) {
$email = $value['master_email'];
// } else {
// $email = substr(md5(uniqid()), rand(0, 22), 10) . "@lihai.com";
// }
$shopMerchantCertificationData = [
'name' => $name,
'organization_code' => $value['organization_code'],
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png',
'master_name' => $value['master_name'],
'master_email' => $email,
'id' => $value['id'],
];
// Db::name('company_form')->where('id', $value['id'])->update(['master_email' => $email]);
queue(TaskTenZehn::class,$shopMerchantCertificationData);
} else {
Db::name('company_form')->where('id', $value['id'])->update(['type' => -1]);
continue;
}
// $a=app(JunziqianController::class)->ShopMerchantCertification($shopMerchantCertificationData);
}
halt($id);
}
public function ceshi1()
{
//认证一条龙
$shopMerchantCertificationData = [
'name' => 1212,
'organization_code' => 2323,
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png',
'master_name' => 3423,
'master_email' => 343,
'id' => 123,
];
app(JunziqianController::class)->ShopMerchantCertification($shopMerchantCertificationData);
halt(111);
}
public function ceshi2()
{
//重新认证
$shopMerchantCertificationData = [
'name' => 1212,
'organization_code' => 2323,
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png',
'master_name' => 3423,
'master_email' => 343,
'id' => 123,
];
app(JunziqianController::class)->organizationReapply($shopMerchantCertificationData);
halt(111);
}
/**
* 企业认证
*/
public function authentication()
{
$params = (new CompanyValidate())->goCheck('detail');
$company = Db::name('company')->where('id', $params['id'])->find();
$qualification = json_decode($company['qualification'], true);
if ($company && $qualification['business_license']) {
$data = [
'name' => $company['company_name'],
'organization_code' => $company['organization_code'],
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png', //$qualification['business_license'],
'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("公司不存在");
}
}
/**发起合同
* 请求参数如下
* id: 14
* 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());
}
}
/**
* 小组服务公司任务下发 线上事故调试和紧急修复预案接口
*/
public function service_group_task_add_test()
{
//任务下发
$companyId = $this->request->param('company_id');
$time = strtotime(date('Y-m-d')); // 今天的000000
// 注意 cron_time
$plan_all = TaskScheduling::where('cron_time', '<', time())
->where('status', 1)
->where('company_type', 18)
->where('company_id', $companyId)
->with('company_info')
->select()
->toArray();
$plan_ids = [];
dd($plan_all);
foreach ($plan_all as $k => $v) {
$all = TaskTemplate::where('status', 1)->where('task_scheduling', $v['id'])->limit(30)->select()->toArray();
$plan_ids[] = $v['id'];
if ($all) {
$plan_all[$k]['template'] = $all;
} else {
unset($plan_all[$k]);
}
}
$company_id = [];
foreach ($plan_all as $k => $v) {
foreach ($v['template'] as $kk => $vv) {
// queue(TaskAdd::class,['data'=>$vv,'data_two'=>$v]);
TaskLogic::CronAdd($vv, $v);
}
$company_id[] = $v['company_id'];
}
Company::where('id', 'in', $company_id)->inc('day_count')->update();
TaskScheduling::where('id', 'in', $plan_ids)->update(['cron_time' => time()]);
Log::info('小组服务公司定时任务下发执行成功' . date('Y-m-d H:i:s'));
return $this->success('定时任务下发执行成功');
}
/**
* 小组服务公司任务结算 线上事故调试和紧急修复预案接口
*/
public function service_group_task_settlement_test()
{
//
$all = TaskSchedulingPlan::whereDay('end_time','today')
->withJoin(['scheduling'], 'left')
->where('scheduling.company_type', 18)
->where('scheduling.company_id', 34)
// ->where('is_pay',0)
->with(['template_info'])
->select()
->toArray();
foreach($all as $k=>$data){
try {
TaskSchedulingPlan::where('id', $data['id'])->update(['is_pay' => 1]);
$company = Company::where('id', $data['company_id'])->field('id,deposit,responsible_area,company_money,shareholder_money,user_id,day_count,company_type,province,city,area,street,village,brigade')->find(); // 可能要判断预存金是否满足
$arr['status'] = 0;
$arr['company_account_type'] = 1;
//信息更新
if ($data['template_info']['type'] == 31) {
if ($data['template_info']['information_count'] < $data['template_info']['information_day_count']) {
Log::info('信息更新任务,信息更新未达到要求:' . json_encode($data));
Task::where('id', $data['task_id'])->update(['status' => 5]);
TaskTemplate::where('id',$data['template_id'])->update(['information_count'=>$data['template_info']['information_day_count']]);
return false;
}
$name = '小组队长';
$arr['status'] = 1;
$task = Task::where('id', $data['task_id'])->field('director_uid,money')->where('status', 3)->find();
$arr['money'] = $task['money'];
Task::where('id', $data['task_id'])->update(['status' => 3]);
} elseif
//交易金额
($data['template_info']['type'] == 33) {
$shang_date_total_price = App(RemoteController::class)->shang_date_total_price($company,[],$data['template_id']);
if ($shang_date_total_price == false) {
Log::info('交易金额任务,交易金额未达到要求:' . json_encode($data));
Task::where('id', $data['task_id'])->update(['status' => 5]);
return false;
}
$transaction_pool=$data['template_info']['transaction_pool'];//交易金额剩余池
$count_money=bcadd($shang_date_total_price['arr']['total_price'],$transaction_pool,2);//交易金额加资金池金额
if($count_money>$shang_date_total_price['arr']['day_money']){
$day_money=bcsub($count_money,$shang_date_total_price['arr']['day_money'],2);//当计算剩余池before_transaction_pool
$shang_date_total_price['arr']['before_transaction_pool']=$transaction_pool;//变化前
$shang_date_total_price['arr']['after_count_transaction_pool']=$count_money;//变化后
$shang_date_total_price['arr']['after_transaction_pool']=$day_money;//变化后
Task::where('id', $data['task_id'])->update(['status' => 3,'extend'=>json_encode(['transaction'=>$shang_date_total_price])]);
TaskTemplate::where('id',$data['template_info']['id'])->update(['transaction_pool'=>$day_money]);
$shang_date_total_price['arr']['status']=1;
}else{
Log::info('交易金额任务,交易金额小于今日金额:' . json_encode($data));
Task::where('id', $data['task_id'])->update(['status' => 5]);
return false;
}
$name = $shang_date_total_price['name'];
$arr['status'] = $shang_date_total_price['arr']['status'];
$task = Task::where('id', $data['task_id'])->field('money')->find();
$arr['money'] = $task['money'];
} elseif
//三轮车
($data['template_info']['type'] == 32){
$task = Task::where('id', $data['task_id'])->field('director_uid,money')->where('status', 3)->with('director_info')->find();
if(empty($task)){
Log::info('三轮车任务 ' . $data['template_info']['title'] . '结算失败,任务为空:' . json_encode($data));
Task::where('id', $data['task_id'])->update(['status' => 5]);
return true;
}
$name=$task['director_info']['nickname'];
$arr['status'] = 1;
$arr['money'] = $task['money'];
}elseif
//入股任务
($data['template_info']['type'] == 35){
$task_35 = Task::where('id', $data['task_id'])->field('director_uid,status,money,start_time,end_time')->with('director_info')->find();
if($task_35){
$day= $data['template_info']['stage_day_one'] + $data['template_info']['stage_day_two'];
// if($task_35['status']==3 && $data['template_info']['day_count']<=$day){
// $name = $task_35['director_info']['nickname'];
// $arr['status'] = 1;
// $arr['money'] = $task_35['money'];
// $arr['company_account_type'] = 2;
// }else{
if ($task_35['status'] == 3) {
return true;
}
/**
* 判断入股任务 单次类型 是否超时
* 未超时时刷新开始结束时间
* 超时则关闭
*/
if($data['template_info']['day_count']<=$day){
TaskSchedulingPlan::where('id', $data['id'])->update(['is_pay' => 0]);
try{
Task::where('id', $data['task_id'])->update(['create_time' => $task_35['start_time']+86400,'update_time' =>time(),'start_time'=>$task_35['start_time']+86400,'end_time'=>$task_35['start_time']+86400+86399]);
}catch(\Exception $e){
$start_time = strtotime(date('Y-m-d'));
Task::where('id', $data['task_id'])->update(['create_time' => $start_time+86400,'update_time' =>time(),'start_time'=>$start_time+86400,'end_time'=> $start_time + 86400+86399]);
}
return false;
}
if($data['template_info']['day_count']>$day){
Task::where('id', $data['task_id'])->update(['status' =>5]);
Log::info('入股任务 ' . $data['template_info']['title'] . '结算失败,任务为超时:' . json_encode($data));
return false;
}
// }
}else{
Log::info('入股任务 ' . $data['template_info']['title'] . '结算失败,任务为空:' . json_encode($data));
return false;
}
}
else {
//其他类型任务
$task = Task::where('id', $data['task_id'])->with('director_info')->find();
if ($task['status'] == 3) {
$name = $task['director_info']['nickname'];
$arr['status'] = 1;
$arr['money'] = $task['money'];
} else if ($task['status'] == 2) {
// 是否超时
$day= $data['template_info']['stage_day_one'] + $data['template_info']['stage_day_two'];
if($data['template_info']['day_count'] >= $day){
Task::where('id', $data['task_id'])->update(['status' =>5]);
Log::info( $data['template_info']['title'] . '结算失败,任务为超时:' . json_encode($data));
return false;
}
if($data['template_info']['day_count'] < $day){
TaskSchedulingPlan::where('id', $data['id'])->update(['is_pay' => 0]);
try{
Task::where('id', $data['task_id'])->update(['create_time' => $task['start_time']+86400,'update_time' =>time(),'start_time'=>$task['start_time']+86400,'end_time'=>$task['start_time']+86400+86399]);
}catch(\Exception $e){
$start_time = strtotime(date('Y-m-d'));
Task::where('id', $data['task_id'])->update(['create_time' => $start_time+86400,'update_time' =>time(),'start_time'=>$start_time+86400,'end_time'=> $start_time + 86400+86399]);
}
return false;
}
}
}
} catch (\Exception $e) {
Log::error('line:'.$e->getLine().'异常报错:任务结算失败:' . $data['template_info']['title'] . $e->getMessage() . json_encode($data));
return false;
}
if ($arr['status'] == 1) {
$arr['company_id'] = $data['scheduling']['company_id'];
$arr['msg'] = '来自任务【' . $data['template_info']['title'] . '】,完成方:' . $name . ',任务结算';
// $arr['proportion_one'] = $data['template_info']['proportion_one'];
// $arr['proportion_two'] = $data['template_info']['proportion_two'];
$arr['sn'] = $data['sn'];
$arr['id'] = $data['id'];
(new ShareProfit())->first($arr, $company,$data);
} else {
Task::where('id', $data['task_id'])->update(['status' => 5]);
Log::info('任务status=0结算失败' . $data['template_info']['title'] . '未完成' . json_encode($data));
}
// queue(TaskInformationJob::class,$v);
}
Log::info('小组服务公司定时任务结算执行成功'.date('Y-m-d H:i:s'));
return $this->success('小组服务公司定时任务结算执行成功');
}
/**
* 镇农科公司任务下发 线上事故调试和紧急修复预案接口
*/
public function town_task_add_ceshi()
{
//任务下发
$companyId = $this->request->param('company_id');
$taskTypeIds = $this->request->param('task_type_ids');
$time = strtotime(date('Y-m-d'));
// 查询系统 所有镇农科公司 未下发 的 任务安排
$taskSchedulingList = TaskScheduling::where('cron_time', '<', time())
->where('status', 1)
->where('company_type', 16)
->where('company_id', $companyId)
->with('company_info')
->select()
->toArray();
$taskSchedulingIds = [];
$companyIds = [];
foreach ($taskSchedulingList as $k => $taskScheduling) {
$templateList = TaskTemplate::where('status', 1)->where('task_scheduling', $taskScheduling['id'])->limit(30)->select()->toArray();
$taskSchedulingIds[] = $taskScheduling['id'];
$companyIds[] = $taskScheduling['company_id'];
foreach ($templateList as $template) {
if (in_array($template['type'], explode(',', $taskTypeIds))) {
TaskLogic::TownCronAdd($template); // 手动下发用
}
// queue(TownTaskAdd::class, $template);
}
if (empty($templateList)) {
unset($taskSchedulingList[$k]);
}
}
Company::where('id', 'in', $companyIds)->inc('day_count')->update();
TaskScheduling::where('id', 'in', $taskSchedulingIds)->update(['cron_time' => time()]);
Log::info('定时任务下发执行成功' . date('Y-m-d H:i:s'));
return $this->success('定时任务下发执行成功');
}
/**
* 镇农科公司任务结算 线上事故调试和紧急修复预案接口
*/
public function town_task_settlement_ceshi()
{
// 今日未结算的任务计划
$taskSchedulingPlanList = TaskSchedulingPlan::whereDay('end_time','today')
->withJoin(['scheduling'], 'left')
->where('scheduling.company_type', 16)
->where('is_pay',0)
->with(['template_info'])
->select()
->toArray();
dd($taskSchedulingPlanList);
foreach($taskSchedulingPlanList as $taskSchedulingPlan) {
if ($taskSchedulingPlan['company_id'] == 30 && $taskSchedulingPlan['template_info']['type'] == 50) {
TaskLogic::townTaskSettlement($taskSchedulingPlan);
}
}
return $this->success('镇农科公司定时任务结算执行成功');
}
/**
* 村管理公司任务下发
*/
public function village_task_add_test()
{
//任务下发
$time = strtotime(date('Y-m-d'));
// 查询系统 所有镇农科公司 未下发 的 任务安排
$taskSchedulingList = TaskScheduling::where('cron_time', '<', time())
->where('status', 1)
->where('company_type', 17)
->where('company_id', 33)
->with('company_info')
->select()
->toArray();
dd($taskSchedulingList);
$taskSchedulingIds = [];
$companyIds = [];
foreach ($taskSchedulingList as $k => $taskScheduling) {
$templateList = TaskTemplate::where('status', 1)->where('task_scheduling', $taskScheduling['id'])->limit(30)->select()->toArray();
$taskSchedulingIds[] = $taskScheduling['id'];
$companyIds[] = $taskScheduling['company_id'];
foreach ($templateList as $template) {
if ($template['type'] == 69) {
TaskLogic::VillageCronAdd($template); // 手动下发用
}
// queue(VillageTaskAdd::class, $template);
}
if (empty($templateList)) {
unset($taskSchedulingList[$k]);
}
}
Company::where('id', 'in', $companyIds)->inc('day_count')->update();
TaskScheduling::where('id', 'in', $taskSchedulingIds)->update(['cron_time' => time()]);
Log::info('村管理公司定时任务下发执行成功' . date('Y-m-d H:i:s'));
return $this->success('村管理公司定时任务下发执行成功');
}
/**
* 村管理公司任务结算
*/
public function village_task_settlement_test()
{
Log::info('村管理公司定时任务结算执行-开始'.date('Y-m-d H:i:s'));
//today 今日未结算的任务计划
$taskSchedulingPlanList = TaskSchedulingPlan::whereDay('end_time','yesterday')
->withJoin(['scheduling'], 'left')
->where('scheduling.company_type', 17)
->where('scheduling.company_id', 33)
->where('is_pay',0)
->with(['template_info'])
->select()
->toArray();
foreach($taskSchedulingPlanList as $taskSchedulingPlan){
TaskLogic::villageTaskSettlement($taskSchedulingPlan);
// queue(VillageTaskSettlementJob::class, $taskSchedulingPlan);
}
Log::info('村管理公司定时任务结算执行-结束'.date('Y-m-d H:i:s'));
return $this->success('村管理公司定时任务结算执行成功');
}
public function countRate()
{
// 第一个月
$startTime1 = strtotime(date('Y-m-d', time())); // 任务下发当天 00:00:00
$endTime1 = strtotime("+30 day", $startTime1); // 30天后的00:0000
// 第二个月
$startTime2 = strtotime(date('Y-m-d', $endTime1)); // 第一个月截止日 00:00:00
$endTime2 = strtotime("+30 day", $startTime2); // 30天后的00:0000
dd([date('Y-m-d H:i:s', $startTime1), date('Y-m-d H:i:s', $endTime1), date('Y-m-d H:i:s', $startTime2), date('Y-m-d H:i:s', $endTime2)]);
$procureAmount = 1234;
$step = $this->request->param('step', 1);
// 商户入驻至今累计天数
$targetProcureAmount = 10000;
// 目标采购额每阶段增幅30%
for ($i = 1; $i < $step; $i++) {
$targetProcureAmount = self::increase($targetProcureAmount);
}
dd($targetProcureAmount);
$rate = bcdiv($procureAmount, $targetProcureAmount, 2);
return $rate;
}
private static function increase($value)
{
return bcmul($value, 1.3,2);
}
/**
* 添加供应链商户
*/
public function addSupplyMerchant()
{
try {
// 添加商户数据
$params = $this->request->param();
$data = [
'mer_intention_id' => 0, // 商城商户入驻申请id签约完成后回调使用
'company_name' => $params['company_name']??'',
'mer_name' => $params['mer_name']??'', // 店铺名称
'organization_code' => $params['organization_code']??'',
'city' => $params['city']??'',
'area' => $params['area']??'',
'street' => $params['street']??'',
'address' => $params['address']??'',
'master_name' => $params['master_name']??'',
'master_phone' => $params['master_phone']??'',
'master_email' => $master_email??'',
'type_name' => $params['type_name'] ?? '', //店铺类型
'category_name' => $params['category_name'] ?? '', //商户分类
'qualification' => !empty($params['images'])?$params['images']:json_encode([])
];
$shopMerchantModel = ShopMerchant::create($data);
$shopMerchantCertificationData = [
'name' => $shopMerchantModel->company_name,
'organization_code' => $shopMerchantModel->organization_code,
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png',
'master_name' => $shopMerchantModel->master_name,
'master_email' => $shopMerchantModel->master_email,
'master_phone' => $shopMerchantModel->master_phone,
'id' => $shopMerchantModel->id,
];
$re = app(JunziqianController::class)->ShopMerchantCertification($shopMerchantCertificationData);
return $this->success('成功', $shopMerchantModel->toArray());
} catch (Exception $e) {
return $this->fail($e->getMessage());
}
}
// 生成合同
public function signSupplyMerchantContract()
{
try {
$params = $this->request->param();
// 生成合同
$createContractData = [
'id' => $params['id'],
'party_a' => $params['party_a'],
'party_a_name' => $params['party_a_name'],
'party_b' => $params['party_b'],
'party_b_name' => $params['party_b_name'],
'contract_type' => 58, // 供应链商户合同
];
$model = new ShopContract();
$model->contract_no = time();
$model->create_time = time();
$model->check_status = 1;
$model->update_time = time();
$model->setAttrs($createContractData);
$res = $model->save($createContractData);
return $this->success('成功', $res->toArray());
} catch (Exception $e) {
return $this->fail($e->getMessage());
}
}
public function testShopApi()
{
$id = $this->request->param('id');
$templateInfo = TaskTemplate::where(['id'=>$id])->find();
$townCompany = Company::where(['id' => $templateInfo['company_id']])->find();
$param['start_time'] = strtotime(date('Y-m-d', $templateInfo['cretate_time'])) + 86400;
$param['end_time'] = time();
$param['mer_intention_id'] = 131;
// $param['goods_id'] = '17,18';
$param['type_id'] = 10;
// todo 返回字段要对接
$result = ShopRequestLogic::getGeneralMerchantProductListing($param);
dd($result);
}
}