Cache.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <?php
  2. namespace app\common\model;
  3. use think\facade\Db;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  9. * 网站地址: https://www.valimart.net/
  10. * ----------------------------------------------------------------------------
  11. *
  12. * ============================================================================
  13. * 数据层模型
  14. */
  15. class Cache extends BaseModel {
  16. /**
  17. * @access public
  18. * @author csdeshang
  19. * @param string $method
  20. * @return boolean
  21. */
  22. public function call($method) {
  23. $method = '_' . strtolower($method);
  24. if (method_exists($this, $method)) {
  25. return $this->$method();
  26. } else {
  27. return false;
  28. }
  29. }
  30. /**
  31. * 基本设置
  32. * @access private
  33. * @author csdeshang
  34. * @return array
  35. */
  36. private function _config() {
  37. $result = Db::name('config')->select()->toArray();
  38. if (is_array($result)) {
  39. $list_config = array();
  40. foreach ($result as $k => $v) {
  41. $list_config[$v['code']] = $v['value'];
  42. }
  43. }
  44. unset($result);
  45. return $list_config;
  46. }
  47. /**
  48. * 商品分类SEO
  49. * @access private
  50. * @author csdeshang
  51. * @return array
  52. */
  53. private function _goodsclassseo() {
  54. $list = Db::name('goodsclass')->field('gc_id,gc_title,gc_keywords,gc_description')->where('gc_keywords','<>','')->select()->toArray();
  55. if (!is_array($list))
  56. return null;
  57. $array = array();
  58. foreach ($list as $k => $v) {
  59. if ($v['gc_title'] != '' || $v['gc_keywords'] != '' || $v['gc_description'] != '') {
  60. if ($v['gc_name'] != '') {
  61. $array[$v['gc_id']]['name'] = $v['gc_name'];
  62. }
  63. if ($v['gc_title'] != '') {
  64. $array[$v['gc_id']]['title'] = $v['gc_title'];
  65. }
  66. if ($v['gc_keywords'] != '') {
  67. $array[$v['gc_id']]['key'] = $v['gc_keywords'];
  68. }
  69. if ($v['gc_description'] != '') {
  70. $array[$v['gc_id']]['desc'] = $v['gc_description'];
  71. }
  72. }
  73. }
  74. return $array;
  75. }
  76. /**
  77. * 商城主要频道SEO
  78. * @access private
  79. * @author csdeshang
  80. * @return array
  81. */
  82. private function _seo() {
  83. $list = Db::name('seo')->select()->toArray();
  84. if (!is_array($list))
  85. return null;
  86. $array = array();
  87. foreach ($list as $key => $value) {
  88. $array[$value['seo_type']] = $value;
  89. }
  90. return $array;
  91. }
  92. /**
  93. * 快递公司
  94. * @access private
  95. * @author csdeshang
  96. * @return array
  97. */
  98. private function _express() {
  99. $fields = 'express_id,express_name,express_state,express_code,express_letter,express_order,express_url';
  100. $list = Db::name('express')->field($fields)->order('express_order,express_letter')->where(array('express_state' => 1))->select()->toArray();
  101. if (!is_array($list))
  102. return null;
  103. $array = array();
  104. foreach ($list as $k => $v) {
  105. $array[$v['express_id']] = $v;
  106. }
  107. return $array;
  108. }
  109. /**
  110. * 自定义导航
  111. * @access private
  112. * @author csdeshang
  113. * @return array
  114. */
  115. private function _nav() {
  116. $list = Db::name('navigation')->order('nav_sort')->select()->toArray();
  117. if (!is_array($list))
  118. return null;
  119. return $list;
  120. }
  121. /**
  122. * 抢购价格区间
  123. * @access private
  124. * @author csdeshang
  125. * @return array
  126. */
  127. private function _groupbuyprice() {
  128. $price = Db::name('groupbuypricerange')->order('gprange_start')->select()->toArray();
  129. if (!is_array($price)){
  130. $price = array();
  131. }else{
  132. $price = ds_change_arraykey($price, 'gprange_id');
  133. }
  134. return $price;
  135. }
  136. /**
  137. * 商品TAG
  138. * @access private
  139. * @author csdeshang
  140. * @return array
  141. */
  142. private function _classtag() {
  143. $field = 'gctag_id,gctag_name,gctag_value,gc_id,type_id';
  144. $list = Db::name('goodsclasstag')->field($field)->select()->toArray();
  145. if (!is_array($list))
  146. return null;
  147. return $list;
  148. }
  149. /**
  150. * 店铺分类
  151. * @access private
  152. * @author csdeshang
  153. * @return array
  154. */
  155. private function _storeclass() {
  156. $store_class_tmp = Db::name('storeclass')->order('storeclass_sort asc,storeclass_id asc')->select()->toArray();
  157. $store_class = array();
  158. if (is_array($store_class_tmp) && !empty($store_class_tmp)) {
  159. foreach ($store_class_tmp as $k => $v) {
  160. $store_class[$v['storeclass_id']] = $v;
  161. }
  162. }
  163. return $store_class;
  164. }
  165. /**
  166. * 店铺等级
  167. * @access private
  168. * @author csdeshang
  169. * @return array
  170. */
  171. private function _storegrade() {
  172. $list = Db::name('storegrade')->select()->toArray();
  173. $array = array();
  174. foreach ((array) $list as $v) {
  175. $array[$v['storegrade_id']] = $v;
  176. }
  177. unset($list);
  178. return $array;
  179. }
  180. /**
  181. * 店铺消息模板
  182. * @access private
  183. * @author csdeshang
  184. * @return array
  185. */
  186. private function _storemsgtpl() {
  187. $list = model('storemsgtpl')->getStoremsgtplList(array());
  188. $array = array();
  189. foreach ((array) $list as $v) {
  190. $array[$v['storemt_code']] = $v;
  191. }
  192. unset($list);
  193. return $array;
  194. }
  195. /**
  196. * 用户消息模板
  197. * @access private
  198. * @author csdeshang
  199. * @return array
  200. */
  201. private function _membermsgtpl() {
  202. $list = model('membermsgtpl')->getMembermsgtplList(array());
  203. $array = array();
  204. foreach ((array) $list as $v) {
  205. $array[$v['membermt_code']] = $v;
  206. }
  207. unset($list);
  208. return $array;
  209. }
  210. /**
  211. * 咨询类型
  212. * @access private
  213. * @author csdeshang
  214. * @return array
  215. */
  216. private function _consulttype() {
  217. $list = model('consulttype')->getConsulttypeList(array());
  218. $array = array();
  219. foreach ((array) $list as $val) {
  220. $val['consulttype_introduce'] = html_entity_decode($val['consulttype_introduce']);
  221. $array[$val['consulttype_id']] = $val;
  222. }
  223. unset($list);
  224. return $array;
  225. }
  226. }