| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\modules\admin\controllers\wechat_mp;
- use app\modules\admin\models\wechat_mp\CardForm;
- use app\models\Store;
- use app\models\Option;
- use app\constants\OptionSetting;
- use EasyWeChat\Factory;
- /**
- * Class GoodsController
- * @package app\modules\admin\controllers
- */
- class CardController extends BaseController
- {
- //用户信息
- public function actionUser(){
- $params = post_params();
- $form = new CardForm();
- $res = $form->getUser($params['code'], $params['card_id']);
- return $this->asJson($res);
- }
- //获取开卡插件参数
- public function actionUrl(){
- $params = post_params();
- $form = new CardForm();
- $res = $form->getUrl($params['card_id']);
- return $this->asJson($res);
- }
- //卡券列表
- public function actionList(){
- $params = post_params();
- $form = new CardForm();
- $store_id = get_store_id();
- $res = $form->getCardList($params, $store_id);
- return $this->asJson($res);
- }
- //卡券详情
- public function actionInfo(){
- $params = post_params();
- $form = new CardForm();
- $store_id = get_store_id();
- $res = $form->getCardInfo($params['card_id']);
- return $this->asJson($res);
- }
- //创建卡券
- public function actionCreate(){
- $params = post_params();
- $form = new CardForm();
- $store_id = get_store_id();
- $res = $form->addCard($params, $store_id);
- return $this->asJson($res);
- }
- //修改卡券
- public function actionUpdate(){
- $params = post_params();
- $form = new CardForm();
- $store_id = get_store_id();
- $res = $form->updateCard($params, $store_id);
- return $this->asJson($res);
- }
- //删除卡券
- public function actionDelete(){
- $params = post_params();
- $form = new CardForm();
- $res = $form->deleteCard($params['card_id']);
- return $this->asJson($res);
- }
- //绑卡列表
- public function actionBindList(){
- $params = post_params();
- $form = new CardForm();
- $store_id = get_store_id();
- $res = $form->getBindList($params, $store_id);
- return $this->asJson($res);
- }
- //修改会员信息
- public function actionUpdateUserBonus() {
- $record_bonus = post_params('record_bonus', '');
- $add_bonus = post_params('add_bonus', 1);
- $bind_ids = post_params('bind_ids', []);
- $form = new CardForm();
- $res = $form->batchUpdateUserBonus($bind_ids, [
- "record_bonus" => $record_bonus,
- "add_bonus" => $add_bonus,
- ]);
- return $this->asJson($res);
- }
- //修改会员信息
- public function actionUpdateUserBonusByCond() {
- $record_bonus = post_params('record_bonus', '');
- $add_bonus = post_params('add_bonus', 1);
- $store_id = get_store_id();
- $cond = post_params('cond', []);
- $form = new CardForm();
- $res = $form->batchUpdateUserBonus($form->getBindIdList($cond, $store_id), [
- "record_bonus" => $record_bonus,
- "add_bonus" => $add_bonus,
- ]);
- return $this->asJson($res);
- }
- }
|