AgencyController.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace app\modules\alliance\controllers;
  8. use app\models\Admin;
  9. use app\models\AgentApply;
  10. use app\models\Option;
  11. use app\models\Order;
  12. use app\models\Salesman;
  13. use app\models\SharingReceiver;
  14. use app\models\Store;
  15. use app\models\StoreReOrder;
  16. use app\models\StoreShareMoney;
  17. use app\models\User;
  18. use app\models\UserShareMoney;
  19. use app\modules\alliance\controllers\BaseController;
  20. use app\modules\alliance\models\AgencyForm;
  21. class AgencyController extends BaseController
  22. {
  23. public function actionLowerLevelShop(){
  24. $form = new AgencyForm();
  25. $form->attributes = post_params();
  26. $res = $form->lowerLevelShop();
  27. return $this->asJson($res);
  28. }
  29. //店铺订单
  30. public function actionShopOrder(){
  31. $form = new AgencyForm();
  32. $form->attributes = post_params();
  33. $res = $form->shopOrder();
  34. return $this->asJson($res);
  35. }
  36. //店铺续费订单
  37. public function actionStoreReOrder(){
  38. $form = new AgencyForm();
  39. $form->attributes = post_params();
  40. $res = $form->storeReOrder();
  41. return $this->asJson($res);
  42. }
  43. //店铺续费订单
  44. public function actionGetDataInfo(){
  45. $form = new AgencyForm();
  46. $res = $form->getDataInfo();
  47. return $this->asJson($res);
  48. }
  49. //佣金明细
  50. public function actionCommission(){
  51. $form = new AgencyForm();
  52. $form->attributes = post_params();
  53. $res = $form->commission();
  54. return $this->asJson($res);
  55. }
  56. //代理中心配置
  57. public function actionAgencyConfig(){
  58. $data = Option::get('agency_config', 0, 'saas');
  59. $type = input_params('type', 0);
  60. if (empty($data['value'])) {
  61. $data = [
  62. 'lowerLevelShop' => "",
  63. 'lowerLevelShopIcon' => "",
  64. 'renewOrder' => "",
  65. 'renewOrderIcon' => "",
  66. 'Withdrawal' => "",
  67. 'WithdrawalIcon' => "",
  68. 'commissionDetail' => "",
  69. 'commissionDetailIcon'=> "",
  70. 'WithdrawalLog' => "",
  71. 'WithdrawalLogIcon' => "",
  72. 'shopOrder' => "",
  73. 'shopOrderIcon' => ""
  74. ];
  75. } else {
  76. $data = json_decode($data['value'], true);
  77. }
  78. if (in_array($type, [0, 1, 2])) {
  79. $agent_apply = AgentApply::findOne(['saas_user_id' => get_saas_user()->id, 'is_delete' => 0, 'agent_type' => $type]);
  80. $admin_type = 'admin';
  81. if ((int)$type === 1) {
  82. $admin_type = 'bd_agent';
  83. }
  84. if ((int)$type === 2) {
  85. $admin_type = 'goods_agent';
  86. }
  87. $admin = Admin::findOne(['saas_user_id' => get_saas_user()->id, 'is_delete' => 0, 'type' => $admin_type]);
  88. $login_data = [
  89. 'name' => $agent_apply->username ?: $admin->username,
  90. 'password' => $agent_apply->password ?: '',
  91. 'url' => "https://" . \Yii::$app->request->hostName,
  92. 'type' => $type
  93. ];
  94. $data = array_merge($data, $login_data);
  95. }
  96. return $this->asJson([
  97. 'code' => 0,
  98. 'msg' => 'success',
  99. 'data' => $data,
  100. ]);
  101. }
  102. }