| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\modules\admin\controllers\maiyatian;
- use app\models\Store;
- use app\models\Option;
- use app\models\Order;
- use app\constants\OptionSetting;
- use app\modules\admin\models\maiyatian\MaiyatianForm;
- use app\modules\admin\models\maiyatian\MaiyatianPush;
- /**
- * Class GoodsController
- * @package app\modules\admin\controllers
- */
- class IndexController extends BaseController
- {
- public function actionTest() {
- $store_id = get_store_id();
- $isopen = MaiyatianForm::refreshToken($store_id);
- }
- public function actionConf() {
- $store_id = get_store_id();
- $isopen = MaiyatianForm::isopen($store_id);
- $conf = MaiyatianForm::conf($store_id);
- $expires_time = 0;
- if($conf['expire_time']){
- $expires_time = $conf['expire_time'];
- }
- return $this->asJson([
- 'code' => 0,
- 'data' => [
- 'conf' => MaiyatianForm::conf($store_id),
- 'isopen' => $isopen,
- 'expires_time' => $expires_time,
- 'category' => MaiyatianForm::$category,
- 'type' => MaiyatianForm::type(),
- ],
- ]);
- }
- public function actionConfSave(){
- $store_id = get_store_id();
- $conf = input_params('conf');
- if(!is_array($conf)){
- $conf = json_decode($conf, true);
- }
- $conf['shop_id'] = $store_id;
- MaiyatianForm::saveConf($store_id, $conf);
- return $this->asJson([
- 'code'=>0,
- 'msg'=>'保存成功'
- ]);
- }
-
- public function actionCreateUrl() {
- $store_id = get_store_id();
- $res = MaiyatianForm::createUrl($store_id);
- return $this->asJson($res);
- }
-
- public function actionRefreshToken() {
- $store_id = get_store_id();
- $res = MaiyatianForm::refreshToken($store_id);
- return $this->asJson($res);
- }
-
- public function actionShopInfo() {
- $store_id = get_store_id();
- $res = MaiyatianForm::shop_info($store_id);
- return $this->asJson($res);
- }
-
- public function actionOrderList() {
- $store_id = get_store_id();
- $params = all_params();
- $res = MaiyatianForm::orderList($store_id, $params);
- return $this->asJson($res);
- }
-
- public function actionOrderCreated() {
- $store_id = get_store_id();
- $order_id = input_params('order_id');
- $res = MaiyatianForm::order_created($store_id, $order_id);
- return $this->asJson($res);
- }
-
- public function actionOrderModified() {
- $store_id = get_store_id();
- $order_id = input_params('order_id');
- $res = MaiyatianForm::order_modified($store_id, $order_id);
- return $this->asJson($res);
- }
-
- public function actionOrderConfirmed() {
- $store_id = get_store_id();
- $order_id = input_params('order_id');
- $res = MaiyatianForm::order_confirmed($store_id, $order_id);
- return $this->asJson($res);
- }
-
- public function actionOrderApplyRefund() {
- $store_id = get_store_id();
- $order_id = input_params('order_id');
- $type = input_params('type', 1);
- $reason = input_params('reason');
- $res = MaiyatianForm::order_apply_refund($store_id, $order_id, $type, $reason);
- return $this->asJson($res);
- }
-
- public function actionOrderCanceled() {
- $store_id = get_store_id();
- $order_id = input_params('order_id');
- $reason = input_params('reason');
- $reason_code = input_params('reason_code', 1);
- $res = MaiyatianForm::order_canceled($store_id, $order_id, $reason, $reason_code);
- return $this->asJson($res);
- }
-
- public function actionOrderRefund() {
- $store_id = get_store_id();
- $order_id = input_params('order_id');
- $status = input_params('status', 1);
- $res = MaiyatianForm::order_refunded($store_id, $order_id, $status);
- return $this->asJson($res);
- }
-
- public function actionOrderDone() {
- $store_id = get_store_id();
- $order_id = input_params('order_id');
- $res = MaiyatianForm::order_done($store_id, $order_id);
- return $this->asJson($res);
- }
-
- public function actionQueryOrder() {
- $store_id = get_store_id();
- $order_id = input_params('order_id');
- $res = MaiyatianForm::query_order($store_id, $order_id);
- return $this->asJson($res);
- }
-
- public function actionCbOrderList() {
- $store_id = get_store_id();
-
- $data = [
- 'shop_id' => $store_id,
- 'start_time' => (time() - 86400*6) * 1000,
- 'end_time' => time() * 1000,
- 'page' => 1,
- 'page_size' => 10,
- ];
- $res = MaiyatianForm::data_order_list($store_id, $data);
- return $this->asJson($res);
- }
-
- public function actionCbOrderDetail() {
- $store_id = get_store_id();
- $order_id = input_params('order_id');
- $res = MaiyatianForm::data_order_detail($store_id, $order_id);
- return $this->asJson($res);
- }
- }
|