|
|
|
@ -5,6 +5,7 @@ use App\Models\AdminSetting; |
|
|
|
use App\Models\Agent; |
|
|
|
use App\Models\MiniProgramTemplate; |
|
|
|
use App\Models\MiniProgramUploadLog; |
|
|
|
use App\Service\OpenPlatform; |
|
|
|
use Dcat\Admin\Grid\RowAction; |
|
|
|
use EasyWeChat\Factory; |
|
|
|
use EasyWeChat\OpenPlatform\Component\Client; |
|
|
|
@ -44,19 +45,11 @@ class MiniProgramReg extends RowAction |
|
|
|
{ |
|
|
|
$agent = Agent::find($this->getKey()); |
|
|
|
|
|
|
|
$setting = AdminSetting::val(['service_appid', 'service_appsecret', 'service_token', 'service_aeskey', 'service_component_phone']); |
|
|
|
$config = [ |
|
|
|
'app_id' => $setting['service_appid'], |
|
|
|
'secret' => $setting['service_appsecret'], |
|
|
|
'token' => $setting['service_token'], |
|
|
|
'aes_key' => $setting['service_aeskey'], |
|
|
|
]; |
|
|
|
|
|
|
|
$openPlatform = Factory::openPlatform($config); |
|
|
|
if (empty($openPlatform['component'])) { |
|
|
|
return $this->response()->error('获取component失败,请检查配置信息是否正确'); |
|
|
|
$openPlatform = new OpenPlatform(); |
|
|
|
$component = $openPlatform->component(); |
|
|
|
if (empty($component)) { |
|
|
|
return $this->response()->error('获取component失败'); |
|
|
|
} |
|
|
|
$component = $openPlatform['component']; |
|
|
|
|
|
|
|
$res = $component->registerMiniProgram([ |
|
|
|
'name' => $agent->company_name, // 企业名
|
|
|
|
@ -64,7 +57,7 @@ class MiniProgramReg extends RowAction |
|
|
|
'code_type' => 1, // 企业代码类型(1:统一社会信用代码, 2:组织机构代码,3:营业执照注册号)
|
|
|
|
'legal_persona_wechat' => $agent->legal_persona_wechat, // 法人微信
|
|
|
|
'legal_persona_name' => $agent->legal_persona_name, // 法人姓名
|
|
|
|
'component_phone' => $setting['service_component_phone'], //第三方联系电话
|
|
|
|
'component_phone' => AdminSetting::val('service_component_phone'), //第三方联系电话
|
|
|
|
]); |
|
|
|
|
|
|
|
$errorArr = $this->regErrorCode(); |
|
|
|
@ -88,20 +81,12 @@ class MiniProgramReg extends RowAction |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
$setting = AdminSetting::val(['service_appid', 'service_appsecret', 'service_token', 'service_aeskey']); |
|
|
|
$config = [ |
|
|
|
'app_id' => $setting['service_appid'], |
|
|
|
'secret' => $setting['service_appsecret'], |
|
|
|
'token' => $setting['service_token'], |
|
|
|
'aes_key' => $setting['service_aeskey'], |
|
|
|
]; |
|
|
|
|
|
|
|
$openPlatform = Factory::openPlatform($config); |
|
|
|
if (empty($openPlatform['component'])) { |
|
|
|
$openPlatform = new OpenPlatform(); |
|
|
|
/** @var Client $component */ |
|
|
|
$component = $openPlatform->component(); |
|
|
|
if (empty($component)) { |
|
|
|
return $this->response()->error('获取component失败,请检查配置信息是否正确'); |
|
|
|
} |
|
|
|
/** @var Client $component */ |
|
|
|
$component = $openPlatform['component']; |
|
|
|
$res = $component->getRegistrationStatus($agent->company_name, $agent->legal_persona_wechat, $agent->legal_persona_name); |
|
|
|
|
|
|
|
$errorArr = $this->searchErrorCode(); |
|
|
|
|