TaskSystem/app/api/controller/CeshiController.php
2023-09-15 13:37:21 +08:00

126 lines
4.6 KiB
PHP

<?php
namespace app\api\controller;
use app\common\logic\CompanyLogic;
use app\common\logic\task\TaskLogic;
use app\common\model\Company;
use app\common\model\company\CompanyAccountLog;
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\common\model\user\User as UserModel;
use app\common\model\user\UserAccountLog;
use think\facade\Log;
use app\job\TaskAdd;
use app\job\TaskInformationJob;
use app\job\TaskTenZehn;
use app\api\controller\JunziqianController;
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'];
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);
}
}