multi-store/app/admin/controller/IndexController.php
mkm 82c1eb1ce6 feat(admin): 添加 demo4 接口并实现价格同步功能
- 在 IndexController 中添加 demo4 方法,用于处理价格同步请求
- 在 DemoLogic 中实现 syncPrice 方法,完成价格同步逻辑
- 支持根据是否为 VIP 用户更新商品价格
- 更新订单总价和商品小计价格
- 如果存在出库单,同步更新仓库商品价格
2025-02-03 14:22:24 +08:00

48 lines
1.2 KiB
PHP

<?php
namespace app\admin\controller;
use app\api\logic\DemoLogic;
use app\common\service\pay\PayService;
class IndexController extends BaseAdminController
{
/**
* @notes 查询订单支付状态
*/
public function wechatQuery()
{
$order_no = $this->request->get('order_no');
$order = [
'out_trade_no' => $order_no,
];
$app = new PayService(0);
try {
$res = $app->wechat->query($order);
return $this->success('查询成功', $res->toArray());
} catch (\Exception $e) {
return $this->fail($e->extra['message']);
}
}
public function demo2()
{
$res=DemoLogic::test();
return $this->success('成功');
}
public function demo3()
{
$id=$this->request->get('id');
$warehouse_id=$this->request->get('warehouse_id',1);
$res=DemoLogic::test3($id,$warehouse_id);
return $this->success('成功');
}
public function demo4()
{
$params=$this->request->get();
$is_vip=$this->request->get('is_vip',0);
$res=DemoLogic::syncPrice($params,$is_vip);
return $this->success('成功');
}
}