截流自动化的商城平台
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Basic.php 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop开源商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | gitee下载:https://gitee.com/likeshop_gitee
  7. // | github下载:https://github.com/likeshop-github
  8. // | 访问官网:https://www.likeshop.cn
  9. // | 访问社区:https://home.likeshop.cn
  10. // | 访问手册:http://doc.likeshop.cn
  11. // | 微信公众号:likeshop技术社区
  12. // | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
  13. // | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
  14. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  15. // | likeshop团队版权所有并拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshop.cn.team
  18. // +----------------------------------------------------------------------
  19. namespace app\admin\controller\setting;
  20. use app\common\server\ConfigServer;
  21. use app\common\server\UrlServer;
  22. use app\common\basics\AdminBase;
  23. use app\admin\logic\setting\BasicLogic;
  24. use app\common\server\JsonServer;
  25. /**
  26. * 基础设置
  27. * Class Basic
  28. * @package app\admin\controller\setting
  29. */
  30. class Basic extends AdminBase
  31. {
  32. /**
  33. * 网站配置
  34. * @return mixed
  35. */
  36. public function website()
  37. {
  38. return view('', [
  39. 'config' => BasicLogic::getBasicConfig()
  40. ]);
  41. }
  42. /**
  43. * Notes: 网站设置
  44. * @author 段誉(2021/6/10 20:32)
  45. * @return \think\response\Json
  46. */
  47. public function setWebsite()
  48. {
  49. $post = $this->request->post();
  50. if (empty($post['type'])) {
  51. return JsonServer::error('参数缺失');
  52. }
  53. if ($post['type'] == 'base') {
  54. BasicLogic::setWebsiteBasic($post);
  55. } elseif ($post['type'] == 'platform') {
  56. BasicLogic::setPlatform($post);
  57. } elseif ($post['type'] == 'shop') {
  58. BasicLogic::setShop($post);
  59. }
  60. return JsonServer::success('修改成功');
  61. }
  62. /**
  63. * Notes: 版权备案
  64. * @author 段誉(2021/6/10 23:55)
  65. * @return \think\response\View
  66. */
  67. public function copyright()
  68. {
  69. $result = BasicLogic::getCopyright();
  70. return view('', $result);
  71. }
  72. /**
  73. * Notes: 设置版权备案
  74. * @author 段誉(2021/6/10 23:55)
  75. * @return \think\response\Json
  76. * @throws \think\db\exception\DataNotFoundException
  77. * @throws \think\db\exception\DbException
  78. * @throws \think\db\exception\ModelNotFoundException
  79. */
  80. public function setCopyright()
  81. {
  82. $post = $this->request->post();
  83. $result = BasicLogic::setCopyright($post);
  84. if (true !== $result) {
  85. return JsonServer::error($result);
  86. }
  87. return JsonServer::success('修改成功');
  88. }
  89. /**
  90. * Notes: APP设置
  91. * @author 段誉(2021/6/11 1:00)
  92. * @return \think\response\View
  93. */
  94. public function app()
  95. {
  96. $config = [
  97. 'line_ios' => ConfigServer::get('app', 'line_ios', ''),
  98. 'line_android' => ConfigServer::get('app', 'line_android', ''),
  99. 'download_doc' => ConfigServer::get('app', 'download_doc', ''),
  100. 'agreement' => ConfigServer::get('app', 'agreement', 0),
  101. 'wechat_login' => ConfigServer::get('app', 'wechat_login', 0),
  102. ];
  103. return view('', ['config' => $config]);
  104. }
  105. public function setApp()
  106. {
  107. $post = $this->request->post();
  108. $post['agreement'] = isset($post['agreement']) && $post['agreement'] == 'on' ? 1 : 0;
  109. $post['wechat_login'] = isset($post['wechat_login']) && $post['wechat_login'] == 'on' ? 1 : 0;
  110. ConfigServer::set('app', 'line_ios',$post['line_ios']);
  111. ConfigServer::set('app', 'line_android',$post['line_android']);
  112. ConfigServer::set('app', 'download_doc',$post['download_doc']);
  113. ConfigServer::set('app', 'agreement',$post['agreement']);
  114. ConfigServer::set('app', 'wechat_login',$post['wechat_login']);
  115. return JsonServer::success('修改成功');
  116. }
  117. /**
  118. * 分享设置
  119. */
  120. public function share()
  121. {
  122. $config = [
  123. 'file_url' => UrlServer::getFileUrl(''),
  124. 'h5' => ConfigServer::get('share', 'h5', [
  125. 'h5_share_title' => '',
  126. 'h5_share_intro' => '',
  127. 'h5_share_image' => ''
  128. ]),
  129. 'mnp' => ConfigServer::get('share', 'mnp', [
  130. 'mnp_share_title' => '',
  131. 'mnp_share_image' => ''
  132. ])
  133. ];
  134. return view('', ['config' => $config]);
  135. }
  136. public function setShare()
  137. {
  138. $post = $this->request->post();
  139. $h5 = json_encode([
  140. 'h5_share_title' => $post['h5_share_title'],
  141. 'h5_share_intro' => $post['h5_share_intro'],
  142. 'h5_share_image' => !empty($post['h5_share_image']) ? UrlServer::setFileUrl($post['h5_share_image']) : '',
  143. ], JSON_UNESCAPED_UNICODE);
  144. $mnp = json_encode([
  145. 'mnp_share_title' => $post['mnp_share_title'],
  146. 'mnp_share_image' => !empty($post['mnp_share_image']) ? UrlServer::setFileUrl($post['mnp_share_image']) : '',
  147. ], JSON_UNESCAPED_UNICODE);
  148. ConfigServer::set('share', 'h5', $h5);
  149. ConfigServer::set('share', 'mnp', $mnp);
  150. return JsonServer::success('修改成功');
  151. }
  152. /**
  153. * Notes: 政策协议
  154. * @author 段誉(2021/6/11 0:41)
  155. * @return mixed
  156. */
  157. public function policy()
  158. {
  159. $config = [
  160. 'service' => HtmlGetImage(ConfigServer::get('policy', 'service')),
  161. 'privacy' => HtmlGetImage(ConfigServer::get('policy', 'privacy')),
  162. 'after_sale' => HtmlGetImage(ConfigServer::get('policy', 'after_sale')),
  163. 'user_delete' => HtmlGetImage(ConfigServer::get('policy', 'user_delete')),
  164. ];
  165. return view('', ['config' => $config]);
  166. }
  167. public function setPolicy()
  168. {
  169. $post = $this->request->post();
  170. if ($post) {
  171. ConfigServer::set('policy', 'service', HtmlSetImage($post['service']));
  172. ConfigServer::set('policy', 'privacy', HtmlSetImage($post['privacy']));
  173. ConfigServer::set('policy', 'after_sale', HtmlSetImage($post['after_sale']));
  174. ConfigServer::set('policy', 'user_delete', HtmlSetImage($post['user_delete']));
  175. return JsonServer::success('修改成功');
  176. }
  177. }
  178. /***
  179. * 会员提现设置
  180. */
  181. public function withdraw(){
  182. $config = [
  183. 'min_withdraw' => ConfigServer::get('withdraw', 'min_withdraw'),
  184. 'max_withdraw' => ConfigServer::get('withdraw', 'max_withdraw'),
  185. 'poundage' => ConfigServer::get('withdraw', 'poundage'),
  186. 'type' => ConfigServer::get('withdraw', 'type') ? ConfigServer::get('withdraw', 'type') : [],
  187. 'transfer_way' => ConfigServer::get('withdraw', 'transfer_way',1),
  188. ];
  189. return view('', ['config' => $config]);
  190. }
  191. /***
  192. * 会员提现设置提交
  193. */
  194. public function setWithdraw()
  195. {
  196. $post = $this->request->post();
  197. if(empty($post['type'])) {
  198. return JsonServer::error('至少选择一种提现方式');
  199. }
  200. if ($post) {
  201. ConfigServer::set('withdraw', 'min_withdraw', $post['min_withdraw']);//最低提现
  202. ConfigServer::set('withdraw', 'max_withdraw', $post['max_withdraw']);//最高提现
  203. ConfigServer::set('withdraw', 'poundage', $post['poundage']);//提现手续费
  204. ConfigServer::set('withdraw', 'type', $post['type']);//提现方式
  205. ConfigServer::set('withdraw', 'transfer_way', $post['transfer_way']);//微信零钱接口
  206. return JsonServer::success('操作成功');
  207. }
  208. }
  209. }