| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\modules\common\controllers;
- use AopClient;
- use \app\models\AlipayAcitvityVoucherOrder;
- use app\models\ActivityOrdervoucher;
- use app\models\AlipayActivityDelivery;
- use app\models\AlipayVoucherCode;
- use app\models\Option;
- use app\models\Store;
- use app\models\StoreAliMini;
- use app\models\StoreAliMiniVersion;
- use app\models\StoreAliShop;
- use app\models\StoreMiniToken;
- use app\models\User;
- use app\models\UserCoupon;
- use app\modules\admin\models\AlipayThirdForm;
- use app\modules\admin\models\alipay\Card;
- use app\utils\Alipay\AlipayProfit;
- use app\utils\Alipay\alipaySdk\aop\request\AlipayOpenAuthTokenAppRequest;
- use yii\web\Controller;
- use app\utils\Delivery\Alipay\ADelivery;
- use app\modules\admin\models\mochat\MochatForm;
- use app\modules\admin\models\OrderListForm;
- use app\models\Order;
- class MochatController extends Controller
- {
- public function actionIndex()
- {
- $_a = get_params('_a');
- if($_a){
- return $this->$_a();
- }
- $agentId = get_params('agentId');
- $store_id = get_params('cyy_store_id');
- $store = Store::findOne(['is_delete' => 0, 'id' => $store_id]);
- if (!$store || empty($agentId)) {
- \Yii::error('<====================>授权回调 参数错误, 参数为:' . json_encode($_GET));
- echo '授权失败,参数错误';
- exit;
- }
- $res = MochatForm::setConfAgentId($store_id, $agentId);
- if ($res['code'] != 0) {
- \Yii::error('<====================> token解析失败, 参数为:' . json_encode($res));
- echo '授权失败,token解析失败,错误信息:' . $res['msg'];
- exit;
- }
- echo '授权成功!';
- exit;
- }
- /**
- * 平台商品订单列表
- * @return \yii\web\Response
- */
- public function actionApi() {
- // debug_log(all_params(), __CLASS__ . '.log');
- $_a = input_params('_a');
- $store_id = input_params('store_id');
- // $isopen = MochatForm::isopen($store_id);
- // if(!$isopen){
- // return $this->asJson([
- // 'code' => 1,
- // 'msg' => '未授权',
- // ]);
- // }
- if($_a && method_exists($this, $_a)){
- $res = $this->$_a($store_id);
- return $res;
- }
- }
- /**
- * 平台商品订单列表
- * @return \yii\web\Response
- */
- public function orderList($store_id) {
- debug_log(all_params(), __CLASS__ . '.log');
- // debug_log(post_params(), __CLASS__ . '.log');
- // debug_log(get_params(), __CLASS__ . '.log');
- // $form = new OrderListForm();
- // $form->attributes = all_params();
- // $form->store_id = $store_id;
- // return $this->asJson($form->search());
- }
-
- public function order($store_id) {
- $wxExternalUserid = input_params('wxExternalUserid');
- $roomId = input_params('roomId', input_params('wxChatId'));
- if(empty($wxExternalUserid) && empty($roomId)){
- return $this->asJson([
- 'code' => 1,
- 'msg' => '参数错误,缺少客户id或群id',
- ]);
- }
- $res = MochatForm::orderList($store_id, $wxExternalUserid, $roomId);
- return $this->asJson($res);
- }
- }
|