feat: 初始化雄戈商城服务端代码与Webhook自动部署配置
这个提交包含在:
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\shopro_wechat_trade;
|
||||
|
||||
use addons\shopro_wechat_trade\library\WxOrderPathService;
|
||||
use addons\shopro_wechat_trade\library\WxTradeConfig;
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
|
||||
class Config extends Backend
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$list = Db::name('shopro_wechat_trade_config')->select();
|
||||
$data = [];
|
||||
foreach ($list as $item) {
|
||||
$data[$item['name']] = $item['value'];
|
||||
}
|
||||
$mini = Db::name('shopro_config')->where('name', 'wxMiniProgram')->value('value');
|
||||
$mini = json_decode($mini, true);
|
||||
$data['mini_program_app_id'] = $mini['app_id'] ?? '';
|
||||
return $this->success('操作成功', null, $data);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$params = $this->request->post('row/a');
|
||||
if (!$params) {
|
||||
$this->error('参数错误');
|
||||
}
|
||||
foreach ($params as $name => $value) {
|
||||
Db::name('shopro_wechat_trade_config')->where('name', $name)->update(['value' => $value]);
|
||||
}
|
||||
WxTradeConfig::reload();
|
||||
$this->success('保存成功');
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
try {
|
||||
$pathService = new WxOrderPathService();
|
||||
$managed = $pathService->isTradeManaged();
|
||||
$path = $pathService->getPath();
|
||||
$this->success('检测完成', null, [
|
||||
'is_trade_managed' => $managed,
|
||||
'order_detail_path' => $path,
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
$this->error('检测失败:' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function initPath()
|
||||
{
|
||||
try {
|
||||
$result = (new WxOrderPathService())->updatePath();
|
||||
$this->success('订单详情路径已配置', null, $result);
|
||||
} catch (\Exception $e) {
|
||||
$this->error('配置失败:' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户