Main.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <?php
  2. namespace Shop\Src;
  3. use Dever;
  4. use Main\Lib\Core;
  5. class Main extends Core
  6. {
  7. public function __construct()
  8. {
  9. parent::__construct();
  10. //$this->checkLogin();
  11. }
  12. public function test()
  13. {
  14. # 退款到原支付账户 待处理
  15. $param = array
  16. (
  17. 'project_id' => 1,
  18. 'channel_id' => 1,
  19. 'system_source' => 5,
  20. 'order_id' => Dever::input('order_id', 'G202112297347788956443487'),
  21. 'refund_cash' => Dever::input('cash', '1'),
  22. 'refund_order_id' => Dever::input('refund_order_id', '1'),
  23. );
  24. $result = Dever::load('pay/api.refund', $param);
  25. print_r($result);die;
  26. $data = array
  27. (
  28. 'character_string6' => array
  29. (
  30. 'value' => '111111112',
  31. ),
  32. 'phrase7' => array
  33. (
  34. 'value' => '已发货',
  35. ),
  36. 'thing8' => array
  37. (
  38. 'value' => '货号',
  39. ),
  40. 'amount1' => array
  41. (
  42. 'value' => '100元',
  43. ),
  44. 'thing5' => array
  45. (
  46. 'value' => '提示',
  47. ),
  48. );
  49. $data = array
  50. (
  51. 'thing3' => array
  52. (
  53. 'value' => '111111112',
  54. ),
  55. 'thing6' => array
  56. (
  57. 'value' => date('Y-m-d H:i:s'),
  58. ),
  59. 'thing7' => array
  60. (
  61. 'value' => '提示',
  62. ),
  63. );
  64. $data = Dever::json_encode($data);
  65. return $data;
  66. }
  67. # 获取当前登录的信息
  68. public function user()
  69. {
  70. $this->data['user'] = $this->user;
  71. $this->data['config'] = Dever::db('main/config')->find();
  72. return $this->data;
  73. }
  74. # 获取模板消息
  75. public function getSubscribeTemplate()
  76. {
  77. $this->data['template'] = Dever::load('wechat_applet/subscribe')->getList();
  78. return $this->data;
  79. }
  80. # 获取店铺信息
  81. public function shop()
  82. {
  83. $id = Dever::input('id');
  84. $this->data['shop'] = Dever::db('shop/info')->find($id);
  85. if ($this->data['shop']) {
  86. unset($this->data['shop']['goods']);
  87. unset($this->data['shop']['factory']);
  88. unset($this->data['shop']['store']);
  89. }
  90. return $this->data;
  91. }
  92. # 获取门店销售小程序首页的数据
  93. public function home()
  94. {
  95. $city = Dever::input('city');
  96. $lng = Dever::input('lng');
  97. $lat = Dever::input('lat');
  98. # 获取门店
  99. $this->data['shop'] = array();
  100. if ($city && $lng && $lat) {
  101. $this->data['shop'] = Dever::load('shop/lib/info')->get($city, $lng, $lat);
  102. }
  103. # 焦点图
  104. $this->data['focus'] = Dever::load('push/lib/data')->get('home_focus', '首页焦点图', 5);
  105. # 获取活动推荐
  106. $this->data['act'] = Dever::load('push/lib/data')->get('home_act', '首页活动推荐', 3);
  107. # 获取热门商品
  108. $this->data['hot'] = Dever::load('push/lib/data')->get('home_hot', '首页热门商品', 6);
  109. # 获取推荐商品
  110. $this->data['top'] = Dever::load('push/lib/data')->get('home_top', '首页推荐商品', 6);
  111. # 首页弹窗
  112. $this->data['alert'] = Dever::load('push/lib/data')->get('home_alert', '首页弹窗', 1);
  113. return $this->data;
  114. }
  115. # 获取店铺列表
  116. public function getShop()
  117. {
  118. $city = Dever::input('city');
  119. $lng = Dever::input('lng');
  120. $lat = Dever::input('lat');
  121. $name = Dever::input('name');
  122. $shop_id = Dever::input('shop_id');
  123. $address = Dever::input('address');
  124. # 获取门店
  125. $this->data['shop'] = array();
  126. if ($city) {
  127. $this->data['shop'] = Dever::load('shop/lib/info')->get($city, $lng, $lat, $name, 'fetchAll', $shop_id, $address);
  128. }
  129. return $this->data;
  130. }
  131. # 获取店铺单个信息
  132. public function getShopOne()
  133. {
  134. $city = Dever::input('city');
  135. $lng = Dever::input('lng');
  136. $lat = Dever::input('lat');
  137. $name = Dever::input('name');
  138. $shop_id = Dever::input('shop_id');
  139. $address = Dever::input('address');
  140. # 获取门店
  141. $this->data['shop'] = array();
  142. if ($city) {
  143. $this->data['shop'] = Dever::load('shop/lib/info')->get($city, $lng, $lat, $name, 'fetch', $shop_id, $address);
  144. }
  145. return $this->data;
  146. }
  147. # 根据店铺获取商品列表
  148. public function getGoods()
  149. {
  150. return Dever::load('shop/lib/goods')->getList();
  151. }
  152. # 获取文章详情
  153. public function news()
  154. {
  155. $id = Dever::input('id');
  156. $this->data['news'] = Dever::load('content/lib/news')->get($id);
  157. return $this->data;
  158. }
  159. # 获取专题详情
  160. public function feature()
  161. {
  162. $id = Dever::input('id');
  163. $this->data['feature'] = Dever::load('content/lib/feature')->get($id);
  164. return $this->data;
  165. }
  166. # 获取平台店信息
  167. public function getShopByType()
  168. {
  169. $where['type'] = 10;
  170. return Dever::db('shop/info')->getDataByType($where);
  171. }
  172. }