SelffetchShopLogic.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop100%开源免费商用商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | 商业版本务必购买商业授权,以免引起法律纠纷
  8. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  9. // | gitee下载:https://gitee.com/likeshop_gitee
  10. // | github下载:https://github.com/likeshop-github
  11. // | 访问官网:https://www.likeshop.cn
  12. // | 访问社区:https://home.likeshop.cn
  13. // | 访问手册:http://doc.likeshop.cn
  14. // | 微信公众号:likeshop技术社区
  15. // | likeshop团队 版权所有 拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshopTeam
  18. // +----------------------------------------------------------------------
  19. namespace app\adminapi\logic\selffetch_shop;
  20. use app\common\logic\BaseLogic;
  21. use app\common\model\SelffetchShop;
  22. class SelffetchShopLogic extends BaseLogic
  23. {
  24. /**
  25. * @notes 添加自提门店
  26. * @param $params
  27. * @return bool
  28. * @author ljj
  29. * @date 2021/8/11 3:14 下午
  30. */
  31. public function add($params)
  32. {
  33. $selffetch_shop = new SelffetchShop;
  34. $selffetch_shop->name = $params['name'];
  35. $selffetch_shop->image = $params['image'];
  36. $selffetch_shop->contact = $params['contact'];
  37. $selffetch_shop->mobile = $params['mobile'];
  38. $selffetch_shop->province = $params['province'];
  39. $selffetch_shop->city = $params['city'] ?? '';
  40. $selffetch_shop->district = $params['district'] ?? '';
  41. $selffetch_shop->address = $params['address'];
  42. $selffetch_shop->longitude = $params['longitude'];
  43. $selffetch_shop->latitude = $params['latitude'];
  44. $selffetch_shop->business_start_time = $params['business_start_time'];
  45. $selffetch_shop->business_end_time = $params['business_end_time'];
  46. $selffetch_shop->weekdays = $params['weekdays'];
  47. $selffetch_shop->status = $params['status'];
  48. $selffetch_shop->remark = $params['remark'] ?? '';
  49. return $selffetch_shop->save();
  50. }
  51. /**
  52. * @notes 编辑自提门店
  53. * @param $params
  54. * @return bool
  55. * @throws \think\db\exception\DataNotFoundException
  56. * @throws \think\db\exception\DbException
  57. * @throws \think\db\exception\ModelNotFoundException
  58. * @author ljj
  59. * @date 2021/8/11 3:29 下午
  60. */
  61. public function edit($params)
  62. {
  63. $selffetch_shop = SelffetchShop::find($params['id']);
  64. $selffetch_shop->name = $params['name'];
  65. $selffetch_shop->image = $params['image'];
  66. $selffetch_shop->contact = $params['contact'];
  67. $selffetch_shop->mobile = $params['mobile'];
  68. $selffetch_shop->province = $params['province'];
  69. $selffetch_shop->city = $params['city'] ?? '';
  70. $selffetch_shop->district = $params['district'] ?? '';
  71. $selffetch_shop->address = $params['address'];
  72. $selffetch_shop->longitude = $params['longitude'];
  73. $selffetch_shop->latitude = $params['latitude'];
  74. $selffetch_shop->business_start_time = $params['business_start_time'];
  75. $selffetch_shop->business_end_time = $params['business_end_time'];
  76. $selffetch_shop->weekdays = $params['weekdays'];
  77. $selffetch_shop->status = $params['status'];
  78. $selffetch_shop->remark = $params['remark'] ?? '';
  79. return $selffetch_shop->save();
  80. }
  81. /**
  82. * @notes 查看自提门店详情
  83. * @param $params
  84. * @return array
  85. * @throws \think\db\exception\DataNotFoundException
  86. * @throws \think\db\exception\DbException
  87. * @throws \think\db\exception\ModelNotFoundException
  88. * @author ljj
  89. * @date 2021/8/11 3:46 下午
  90. */
  91. public function detail($params)
  92. {
  93. $info = SelffetchShop::find($params['id'])->toArray();
  94. return $info;
  95. }
  96. /**
  97. * @notes 修改自提门店状态
  98. * @param $params
  99. * @return bool
  100. * @throws \think\db\exception\DataNotFoundException
  101. * @throws \think\db\exception\DbException
  102. * @throws \think\db\exception\ModelNotFoundException
  103. * @author ljj
  104. * @date 2021/8/11 4:18 下午
  105. */
  106. public function status($params)
  107. {
  108. $selffetch_shop = SelffetchShop::find($params['id']);
  109. $selffetch_shop->status = $params['status'];
  110. return $selffetch_shop->save();
  111. }
  112. /**
  113. * @notes 删除自提门店
  114. * @param $params
  115. * @return bool
  116. * @author ljj
  117. * @date 2021/8/11 5:12 下午]
  118. */
  119. public function del($params)
  120. {
  121. return SelffetchShop::destroy($params['id']);
  122. }
  123. /**
  124. * @notes 腾讯地图区域搜索
  125. * @param $params
  126. * @return mixed
  127. * @author ljj
  128. * @date 2021/9/28 6:42 下午
  129. */
  130. public function regionSearch($params)
  131. {
  132. $query = http_build_query($params);
  133. $url = 'https://apis.map.qq.com/ws/place/v1/search';//城市、区域搜索api
  134. return json_decode(file_get_contents($url.'?'.$query),true);
  135. }
  136. }