PublicRankingController.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace app\modules\client\controllers\v1;
  8. use app\modules\client\controllers\BaseController;
  9. use app\modules\admin\models\publicRanking\PublicRankingForm;
  10. use app\modules\admin\models\VideoShopGoodsForm;
  11. use app\modules\admin\models\VideoShopOrderForm;
  12. use app\models\PublicRankingTask;
  13. use app\models\Promoter;
  14. class PublicRankingController extends BaseController
  15. {
  16. public function actionSetting()
  17. {
  18. $store_id = get_store_id();
  19. return $this->asJson([
  20. 'code' => 0,
  21. 'data' => PublicRankingForm::conf($store_id),
  22. ]);
  23. }
  24. public function actionIndex()
  25. {
  26. $store_id = get_store_id();
  27. $user_id = get_user_id();
  28. $result = PublicRankingForm::publicRankingUserIndex($store_id, $user_id);
  29. return $this->asJson($result);
  30. }
  31. public function actionTask()
  32. {
  33. $store_id = get_store_id();
  34. $user_id = get_user_id();
  35. $result = PublicRankingForm::publicRankingUserIndexTask($store_id, $user_id, input_params('task_id'));
  36. return $this->asJson($result);
  37. }
  38. public function actionShopGoodsList() {
  39. $form = new VideoShopGoodsForm();
  40. $form->attributes = get_params();
  41. $form->store_id = get_store_id();
  42. $form->mini_id = PublicRankingForm::conf(get_store_id())['mini_id'];
  43. $form->status = -1;
  44. $res = $form->shopGoodsList(array_merge(['wx_status' => 5], all_params()));
  45. return $this->asJson($res);
  46. }
  47. public function actionTaskOrder()
  48. {
  49. $form = new VideoShopOrderForm();
  50. $form->attributes = get_params();
  51. $form->store_id = get_store_id();
  52. $form->mini_id = PublicRankingForm::conf(get_store_id())['mini_id'];
  53. $form->status = -2;
  54. $params = array_merge(all_params(), ['order_id' => PublicRankingTask::find()->where(['user_id' => get_user_id()])->select('order_id')]);
  55. $res = $form->getSharerOrderList($params);
  56. return $this->asJson($res);
  57. }
  58. public function actionPromAdd()
  59. {
  60. $store_id = get_store_id();
  61. $user_id = get_user_id();
  62. $result = PublicRankingForm::publicRankingUserIndexPromAdd($store_id, $user_id, input_params('promoter_id'), input_params('finder_id'), input_params('finder_name'));
  63. return $this->asJson($result);
  64. }
  65. public function actionOrder()
  66. {
  67. $form = new VideoShopOrderForm();
  68. $form->attributes = get_params();
  69. $form->store_id = get_store_id();
  70. $form->mini_id = PublicRankingForm::conf(get_store_id())['mini_id'];
  71. $params = array_merge(all_params(), ['promoter_id' => Promoter::find()->where(['store_id' => get_store_id(), 'user_id' => get_user_id()])->select('promoter_id')]);
  72. $res = $form->getSharerOrderList($params);
  73. return $this->asJson($res);
  74. }
  75. }