作者 lyh

gx

@@ -185,8 +185,8 @@ class DomainInfo extends Command @@ -185,8 +185,8 @@ class DomainInfo extends Command
185 public function updateDomain($domain){ 185 public function updateDomain($domain){
186 $url = 'http://openai.waimaoq.com/v1/whois_api?domain='.$domain; 186 $url = 'http://openai.waimaoq.com/v1/whois_api?domain='.$domain;
187 $response = http_get($url); 187 $response = http_get($url);
188 - $start = '';  
189 - $end = ''; 188 + $start = date('Y-m-d H:i:s');
  189 + $end = date('Y-m-d H:i:s');
190 if($response['code'] == 200){ 190 if($response['code'] == 200){
191 $start = $response['text']['creation_date']; 191 $start = $response['text']['creation_date'];
192 $end = $response['text']['expiration_date']; 192 $end = $response['text']['expiration_date'];
@@ -13,6 +13,7 @@ use App\Models\User\ProjectMenu; @@ -13,6 +13,7 @@ use App\Models\User\ProjectMenu;
13 use App\Models\User\ProjectRole; 13 use App\Models\User\ProjectRole;
14 use App\Services\SyncService; 14 use App\Services\SyncService;
15 use App\Utils\HttpUtils; 15 use App\Utils\HttpUtils;
  16 +use App\Utils\LogUtils;
16 use GuzzleHttp\Exception\GuzzleException; 17 use GuzzleHttp\Exception\GuzzleException;
17 use Illuminate\Support\Arr as SupArr; 18 use Illuminate\Support\Arr as SupArr;
18 use App\Helper\Arr; 19 use App\Helper\Arr;
@@ -35,6 +36,7 @@ use App\Services\ProjectServer; @@ -35,6 +36,7 @@ use App\Services\ProjectServer;
35 use Hashids\Hashids; 36 use Hashids\Hashids;
36 use App\Models\User\User as UserModel; 37 use App\Models\User\User as UserModel;
37 use Illuminate\Support\Facades\DB; 38 use Illuminate\Support\Facades\DB;
  39 +use Illuminate\Support\Facades\Http;
38 use Illuminate\Support\Facades\Log; 40 use Illuminate\Support\Facades\Log;
39 use Illuminate\Support\Facades\Schema; 41 use Illuminate\Support\Facades\Schema;
40 use Illuminate\Support\Str; 42 use Illuminate\Support\Str;
@@ -704,6 +706,30 @@ class ProjectLogic extends BaseLogic @@ -704,6 +706,30 @@ class ProjectLogic extends BaseLogic
704 * @time :2023/11/17 15:26 706 * @time :2023/11/17 15:26
705 */ 707 */
706 public function saveOtherProject(){ 708 public function saveOtherProject(){
  709 + //获取当前数据详情
  710 + $projectInfo = $this->getProjectInfo($this->param['id']);
  711 + //aicc
  712 + if(($projectInfo['aicc'] == Project::TYPE_ZERO) && ($this->param['aicc'] == Project::TYPE_ONE)){
  713 + $data = [
  714 + 'company_name'=>$projectInfo['company'],
  715 + 'principal_mobile'=>$projectInfo['mobile'],
  716 + 'remark'=>'',
  717 + 'exclusive_aicc_day'=>$projectInfo['exclusive_aicc_day'] ?: 1,
  718 + 'from_order_id'=>$projectInfo['from_order_id']
  719 + ];
  720 + $this->toAicc($data);
  721 + }
  722 + //黑格
  723 + if(($projectInfo['hagro'] == Project::TYPE_ZERO) && ($this->param['hagro'] == Project::TYPE_ONE)){
  724 + $data = [
  725 + 'company_name'=>$projectInfo['company'],
  726 + 'principal_mobile'=>$projectInfo['mobile'],
  727 + 'exclusive_hagro_day'=>$projectInfo['exclusive_hagro_day'] ?: 1,
  728 + 'from_order_id'=>$projectInfo['from_order_id'],
  729 + 'company_id'=>$projectInfo['channel']['channel_id']
  730 + ];
  731 + $this->toAicc($data);
  732 + }
707 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); 733 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
708 if($rs === false){ 734 if($rs === false){
709 $this->fail('保存失败,请联系管理员'); 735 $this->fail('保存失败,请联系管理员');
@@ -723,4 +749,62 @@ class ProjectLogic extends BaseLogic @@ -723,4 +749,62 @@ class ProjectLogic extends BaseLogic
723 return $this->success($info); 749 return $this->success($info);
724 } 750 }
725 751
  752 + /**
  753 + * 同步到AICC
  754 + * @param $data
  755 + * @author zbj
  756 + * @date 2023/9/1
  757 + */
  758 + protected function toAicc($data){
  759 + $url = 'https://biz.ai.cc/api/sync_company_for_order';
  760 + $param = [
  761 + 'company_name' => $data['company_name'],
  762 + 'company_address' => '',
  763 + 'company_tel' => $data['principal_mobile'],
  764 + 'company_email' => '',
  765 + 'remark' => $data['remark'],
  766 + 'level_id' => 6,
  767 + 'level_day' => $data['exclusive_aicc_day'] ?: 1,
  768 + 'from_order_id' => $data['from_order_id'],
  769 + ];
  770 + //sign
  771 + ksort($param);
  772 + $tem = [];
  773 + foreach ($param as $key => $val) {
  774 + $tem[] = $key . '=' . urlencode($val);
  775 + }
  776 + $string = implode('&', $tem);
  777 + $key = md5('quanqiusou.com');
  778 + $param['sign'] = md5($string . $key);
  779 + $res = Http::withoutVerifying()->post($url, $param)->json();
  780 + if(empty($res['status']) || $res['status'] != 200){
  781 + LogUtils::error('ProjectToAicc error', $res);
  782 + }
  783 + return true;
  784 + }
  785 +
  786 + /**
  787 + * 同步到Hagro
  788 + * @param $data
  789 + * @author zbj
  790 + * @date 2023/9/1
  791 + */
  792 + protected function toHagro($data){
  793 + $url = 'https://admin.hagro.cn/globalso/create_project';
  794 + $param = [
  795 + 'company' => $data['company_name'],
  796 + 'phone' => $data['principal_mobile'],
  797 + 'planday' => $data['exclusive_hagro_day'] ?: 1,
  798 + 'from_order_id' => $data['from_order_id'],
  799 + 'agent_phone' => Channel::where('source_id', $data['company_id'])->value('contact_mobile') ?: '',
  800 + ];
  801 + $common = new Common();
  802 + $token = $common->encrypt($param);
  803 + $res = Http::withoutVerifying()->get($url, ['token' => $token])->json();
  804 + if(empty($res['code']) || $res['code'] != 200){
  805 + $this->fail('ProjectToHagro error');
  806 + }
  807 + return true;
  808 + }
  809 +
726 } 810 }