WechatMiniMerchantController.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace app\modules\admin\controllers;
  8. use app\models\MerchantInfo;
  9. use app\models\StoreSchedule;
  10. use app\modules\admin\models\WechatMiniMerchantForm;
  11. class WechatMiniMerchantController extends BaseController
  12. {
  13. public function actionSetMerchantInfo()
  14. {
  15. $form = new WechatMiniMerchantForm();
  16. $form->id = post_params("id", 0) ?: get_params("id", 0);
  17. //如果是get就获取数据
  18. if (\Yii::$app->request->isGet) {
  19. $res = $form->merchantInfo();
  20. } else {
  21. $form->merchant_info = post_params("merchant_info");
  22. $res = $form->save();
  23. }
  24. return $this->asJson($res);
  25. }
  26. public function actionList()
  27. {
  28. $form = new WechatMiniMerchantForm();
  29. $form->status = get_params("status",-1);
  30. $res = $form->list();
  31. return $this->asJson($res);
  32. }
  33. public function actionGetCountry()
  34. {
  35. $form = new WechatMiniMerchantForm();
  36. $res = $form->getCountry();
  37. return $this->asJson($res);
  38. }
  39. // 获取小程序开始使用/暂停使用
  40. public function actionMiniIsUse(){
  41. $form = new WechatMiniMerchantForm();
  42. $form->id = post_params("id")??get_params("id");
  43. $form->is_use = post_params("is_use");
  44. $res = $form->unbind();
  45. return $this->asJson($res);
  46. }
  47. //绑定商户号 非进件逻辑需要添加进件数据
  48. public function actionSetTemporaryInfo() {
  49. $form = new WechatMiniMerchantForm();
  50. $form->attributes = post_params();
  51. $form->store_id = get_store_id();
  52. $res = $form->setTemporaryInfo();
  53. return $this->asJson($res);
  54. }
  55. public function actionDeleteMerchantInfo() {
  56. $form = new WechatMiniMerchantForm();
  57. $form->id = post_params("id")??get_params("id");
  58. $res = $form->deleteMerchantInfo();
  59. return $this->asJson($res);
  60. }
  61. }