Cache.php 7.0 KB

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