作者 lyh

gx

... ... @@ -185,8 +185,8 @@ class DomainInfo extends Command
public function updateDomain($domain){
$url = 'http://openai.waimaoq.com/v1/whois_api?domain='.$domain;
$response = http_get($url);
$start = '';
$end = '';
$start = date('Y-m-d H:i:s');
$end = date('Y-m-d H:i:s');
if($response['code'] == 200){
$start = $response['text']['creation_date'];
$end = $response['text']['expiration_date'];
... ...
... ... @@ -13,6 +13,7 @@ use App\Models\User\ProjectMenu;
use App\Models\User\ProjectRole;
use App\Services\SyncService;
use App\Utils\HttpUtils;
use App\Utils\LogUtils;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Support\Arr as SupArr;
use App\Helper\Arr;
... ... @@ -35,6 +36,7 @@ use App\Services\ProjectServer;
use Hashids\Hashids;
use App\Models\User\User as UserModel;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
... ... @@ -704,6 +706,30 @@ class ProjectLogic extends BaseLogic
* @time :2023/11/17 15:26
*/
public function saveOtherProject(){
//获取当前数据详情
$projectInfo = $this->getProjectInfo($this->param['id']);
//aicc
if(($projectInfo['aicc'] == Project::TYPE_ZERO) && ($this->param['aicc'] == Project::TYPE_ONE)){
$data = [
'company_name'=>$projectInfo['company'],
'principal_mobile'=>$projectInfo['mobile'],
'remark'=>'',
'exclusive_aicc_day'=>$projectInfo['exclusive_aicc_day'] ?: 1,
'from_order_id'=>$projectInfo['from_order_id']
];
$this->toAicc($data);
}
//黑格
if(($projectInfo['hagro'] == Project::TYPE_ZERO) && ($this->param['hagro'] == Project::TYPE_ONE)){
$data = [
'company_name'=>$projectInfo['company'],
'principal_mobile'=>$projectInfo['mobile'],
'exclusive_hagro_day'=>$projectInfo['exclusive_hagro_day'] ?: 1,
'from_order_id'=>$projectInfo['from_order_id'],
'company_id'=>$projectInfo['channel']['channel_id']
];
$this->toAicc($data);
}
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
if($rs === false){
$this->fail('保存失败,请联系管理员');
... ... @@ -723,4 +749,62 @@ class ProjectLogic extends BaseLogic
return $this->success($info);
}
/**
* 同步到AICC
* @param $data
* @author zbj
* @date 2023/9/1
*/
protected function toAicc($data){
$url = 'https://biz.ai.cc/api/sync_company_for_order';
$param = [
'company_name' => $data['company_name'],
'company_address' => '',
'company_tel' => $data['principal_mobile'],
'company_email' => '',
'remark' => $data['remark'],
'level_id' => 6,
'level_day' => $data['exclusive_aicc_day'] ?: 1,
'from_order_id' => $data['from_order_id'],
];
//sign
ksort($param);
$tem = [];
foreach ($param as $key => $val) {
$tem[] = $key . '=' . urlencode($val);
}
$string = implode('&', $tem);
$key = md5('quanqiusou.com');
$param['sign'] = md5($string . $key);
$res = Http::withoutVerifying()->post($url, $param)->json();
if(empty($res['status']) || $res['status'] != 200){
LogUtils::error('ProjectToAicc error', $res);
}
return true;
}
/**
* 同步到Hagro
* @param $data
* @author zbj
* @date 2023/9/1
*/
protected function toHagro($data){
$url = 'https://admin.hagro.cn/globalso/create_project';
$param = [
'company' => $data['company_name'],
'phone' => $data['principal_mobile'],
'planday' => $data['exclusive_hagro_day'] ?: 1,
'from_order_id' => $data['from_order_id'],
'agent_phone' => Channel::where('source_id', $data['company_id'])->value('contact_mobile') ?: '',
];
$common = new Common();
$token = $common->encrypt($param);
$res = Http::withoutVerifying()->get($url, ['token' => $token])->json();
if(empty($res['code']) || $res['code'] != 200){
$this->fail('ProjectToHagro error');
}
return true;
}
}
... ...