Shopreopen.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
  9. * 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
  10. * =========================================================
  11. */
  12. namespace app\shopapi\controller;
  13. use app\model\shop\ShopReopen as ShopReopenModel;
  14. /**
  15. * 店铺
  16. * Class Shop
  17. * @package app\shop\controller
  18. */
  19. class Shopreopen extends BaseApi
  20. {
  21. public function __construct()
  22. {
  23. //执行父类构造函数
  24. parent::__construct();
  25. $token = $this->checkToken();
  26. if ($token[ 'code' ] < 0) {
  27. echo $this->response($token);
  28. exit;
  29. }
  30. }
  31. public function getReopenDetail()
  32. {
  33. $reopen_model = new ShopReopenModel();
  34. $reopen_info = $reopen_model->getReopenInfo([ [ 'sr.apply_state', 'in', '-1,1' ], [ 'sr.site_id', '=', $this->site_id ] ], '*');
  35. return $this->response($reopen_info);
  36. }
  37. /**
  38. * 获取续费信息
  39. */
  40. public function getReopenInfo()
  41. {
  42. $reopen_model = new ShopReopenModel();
  43. $id = isset($this->params[ 'id' ]) ? $this->params[ 'id' ] : '';
  44. //获取续签信息
  45. $result = $reopen_model->getReopenInfo([ [ 'sr.id', '=', $id ], [ 'sr.site_id', '=', $this->site_id ] ], '*');
  46. return $this->response($result);
  47. }
  48. /**
  49. * 添加续签
  50. * @return false|string
  51. */
  52. public function addReopen()
  53. {
  54. $reopen_data = [
  55. 'site_id' => $this->site_id,//店铺ID
  56. 'apply_year' => isset($this->params[ 'apply_year' ]) ? $this->params[ 'apply_year' ] : '',//入驻年长
  57. 'shop_group_name' => isset($this->params[ 'shop_group_name' ]) ? $this->params[ 'shop_group_name' ] : '',//开店套餐名称
  58. 'shop_group_id' => isset($this->params[ 'shop_group_id' ]) ? $this->params[ 'shop_group_id' ] : '',//开店套餐id
  59. 'paying_money_certificate' => isset($this->params[ 'paying_money_certificate' ]) ? $this->params[ 'paying_money_certificate' ] : '',//支付凭证
  60. 'paying_money_certificate_explain' => isset($this->params[ 'paying_money_certificate_explain' ]) ? $this->params[ 'paying_money_certificate_explain' ] : ''//付款凭证说明
  61. ];
  62. $reopen_model = new ShopReopenModel();
  63. //计算入驻金额
  64. $apply_money = $reopen_model->getReopenMoney($reopen_data[ 'apply_year' ], $reopen_data[ 'shop_group_id' ]);
  65. $reopen_data[ 'paying_amount' ] = $apply_money[ 'data' ][ 'money' ];
  66. $result = $reopen_model->addReopen($reopen_data);
  67. return $this->response($result);
  68. }
  69. /**
  70. * 编辑续签
  71. * @return false|string
  72. */
  73. public function editReopen()
  74. {
  75. $reopen_data = [
  76. 'site_id' => $this->site_id,
  77. 'id' => isset($this->params[ 'id' ]) ? $this->params[ 'id' ] : '',
  78. 'paying_money_certificate' => isset($this->params[ 'paying_money_certificate' ]) ? $this->params[ 'paying_money_certificate' ] : '',//支付凭证
  79. 'paying_money_certificate_explain' => isset($this->params[ 'paying_money_certificate_explain' ]) ? $this->params[ 'paying_money_certificate_explain' ] : ''//付款凭证说明
  80. ];
  81. $model = new ShopReopenModel();
  82. $result = $model->editReopen($reopen_data);
  83. return $this->response($result);
  84. }
  85. /*
  86. * 删除续签
  87. */
  88. public function deleteReopen()
  89. {
  90. $id = isset($this->params[ 'id' ]) ? $this->params[ 'id' ] : '';
  91. $model = new ShopReopenModel();
  92. $res = $model->deleteReopen($id);
  93. return $this->response($res);
  94. }
  95. /**
  96. * 获取续签金额
  97. */
  98. public function getReopenMoney()
  99. {
  100. $apply_year = isset($this->params[ 'apply_year' ]) ? $this->params[ 'apply_year' ] : '';//入驻年长
  101. $group_id = isset($this->params[ 'group_id' ]) ? $this->params[ 'group_id' ] : '';//店铺等级ID
  102. $model = new ShopReopenModel();
  103. $result = $model->getReopenMoney($apply_year, $group_id);
  104. return $this->response($result);
  105. }
  106. }