Dashboard.php 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  1. <?php
  2. namespace app\admin\controller;
  3. use think\facade\View;
  4. use think\facade\Db;
  5. use think\facade\Lang;
  6. /**
  7. * ============================================================================
  8. *
  9. * ============================================================================
  10. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  11. * 网站地址: https://www.valimart.net/
  12. * ----------------------------------------------------------------------------
  13. *
  14. * ============================================================================
  15. * 控制器
  16. */
  17. class Dashboard extends AdminControl {
  18. public function initialize() {
  19. parent::initialize(); // TODO: Change the autogenerated stub
  20. Lang::load(base_path() . 'admin/lang/'.config('lang.default_lang').'/dashboard.lang.php');
  21. include_once root_path(). 'extend/mall/statistics.php';
  22. include_once root_path(). 'extend/mall/datehelper.php';
  23. }
  24. function index() {
  25. $this->welcome();
  26. }
  27. /*
  28. * 检查是否为最新版本
  29. */
  30. function version() {
  31. //当前版本
  32. $curent_version = file_get_contents(base_path() . 'version.php');
  33. //获取最新版本信息
  34. $vaules = array(
  35. 'domain'=>$_SERVER['HTTP_HOST'],
  36. 'version'=>$curent_version,
  37. );
  38. $service_url = "http://service.csdeshang.com/index.php/home/Version/checkDsmall.html?".http_build_query($vaules);
  39. //设置超时时间
  40. $opts = array(
  41. 'http' =>
  42. array(
  43. 'timeout' => 3
  44. )
  45. );
  46. $context = stream_context_create($opts);
  47. $service_info = @file_get_contents($service_url,FALSE,$context);
  48. $version_message = json_decode($service_info);
  49. View::assign('version_message', $version_message);
  50. }
  51. function welcome() {
  52. $this->version();
  53. /**
  54. * 管理员信息
  55. */
  56. $admin_model = model('admin');
  57. $tmp = $this->getAdminInfo();
  58. $condition = array();
  59. $condition[] = array('admin_id','=',$tmp['admin_id']);
  60. $admin_info = $admin_model->infoAdmin($condition);
  61. $admin_info['admin_login_time'] = date('Y-m-d H:i:s', ($admin_info['admin_login_time'] == '' ? TIMESTAMP : $admin_info['admin_login_time']));
  62. /**
  63. * 系统信息
  64. */
  65. $setup_date = config('ds_config.setup_date');
  66. $statistics['tp_version'] = \think\App::VERSION;
  67. $statistics['os'] = PHP_OS;
  68. $statistics['web_server'] = $_SERVER['SERVER_SOFTWARE'];
  69. $statistics['php_version'] = PHP_VERSION;
  70. $statistics['sql_version'] = $this->_mysql_version();
  71. //$statistics['shop_version'] = $version;
  72. $statistics['setup_date'] = substr($setup_date, 0, 10);
  73. $statistics['domain'] = $_SERVER['HTTP_HOST'];
  74. $statistics['ip'] = GetHostByName($_SERVER['SERVER_NAME']);
  75. $statistics['zlib'] = function_exists('gzclose') ? 'YES' : 'NO'; //zlib
  76. $statistics['safe_mode'] = (boolean) ini_get('safe_mode') ? 'YES' : 'NO'; //safe_mode = Off
  77. $statistics['timezone'] = function_exists("date_default_timezone_get") ? date_default_timezone_get() : "no_timezone";
  78. $statistics['curl'] = function_exists('curl_init') ? 'YES' : 'NO';
  79. $statistics['fileupload'] = @ini_get('file_uploads') ? ini_get('upload_max_filesize') : 'unknown';
  80. $statistics['max_ex_time'] = @ini_get("max_execution_time") . 's'; //脚本最大执行时间
  81. $statistics['set_time_limit'] = function_exists("set_time_limit") ? true : false;
  82. $statistics['memory_limit'] = ini_get('memory_limit');
  83. $statistics['version'] = file_get_contents(base_path() . 'version.php');
  84. if (function_exists("gd_info")) {
  85. $gd = gd_info();
  86. $statistics['gdinfo'] = $gd['GD Version'];
  87. } else {
  88. $statistics['gdinfo'] = lang('ds_unknown');
  89. }
  90. View::assign('statistics', $statistics);
  91. View::assign('admin_info', $admin_info);
  92. $this->_stat_json();
  93. $this->setAdminCurItem('welcome');
  94. echo View::fetch('welcome');
  95. exit;
  96. }
  97. private function _stat_json()
  98. {
  99. $this->_get_week_member();
  100. $this->_get_week_goods();
  101. $this->_get_week_store();
  102. $this->_get_week_order();
  103. }
  104. /**
  105. * 获取本周新增订单数量
  106. */
  107. private function _get_week_order()
  108. {
  109. $field = ' COUNT(*) as allnum ';
  110. $current_weekarr = getWeek_SdateAndEdate(TIMESTAMP);
  111. $stime = strtotime($current_weekarr['sdate']) - 86400 * 7;
  112. $etime = strtotime($current_weekarr['edate']) + 86400 - 1;
  113. //总计的查询时间
  114. $count_arr['seartime'] = ($stime + 86400 * 7) . '|' . $etime;
  115. $up_week = @date('W', $stime); //上周
  116. $curr_week = @date('W', $etime); //本周
  117. //构造横轴数据
  118. for ($i = 1; $i <= 7; $i++) {
  119. //统计图数据
  120. $up_arr[$i] = 0;
  121. $curr_arr[$i] = 0;
  122. $tmp_weekarr = getSystemWeekArr();
  123. //统计表数据
  124. $currlist_arr[$i]['timetext'] = $tmp_weekarr[$i];
  125. //方便搜索会员列表,计算开始时间和结束时间
  126. $currlist_arr[$i]['stime'] = strtotime($current_weekarr['sdate']) + ($i - 1) * 86400;
  127. $currlist_arr[$i]['etime'] = $currlist_arr[$i]['stime'] + 86400 - 1;
  128. $uplist_arr[$i]['val'] = 0;
  129. $currlist_arr[$i]['val'] = 0;
  130. //横轴
  131. $stat_arr['xAxis']['categories'][] = $tmp_weekarr[$i];
  132. unset($tmp_weekarr);
  133. }
  134. $where = array();
  135. $where[] = array('add_time','between', array($stime, $etime));
  136. $field .= ',WEEKOFYEAR(FROM_UNIXTIME(add_time)) as weekval,WEEKDAY(FROM_UNIXTIME(add_time))+1 as dayofweekval ';
  137. $orderlist = Db::name('order')->field($field)->where($where)->group('weekval,dayofweekval')->select()->toArray();
  138. if ($orderlist) {
  139. foreach ($orderlist as $k => $v) {
  140. if ($up_week == intval($v['weekval'])) {
  141. $up_arr[$v['dayofweekval']] = intval($v['allnum']);
  142. $uplist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
  143. if(isset($count_arr['up'])){
  144. $count_arr['up'] += intval($v['allnum']);
  145. }else{
  146. $count_arr['up'] = 0;
  147. }
  148. }
  149. if ($curr_week == $v['weekval']) {
  150. $curr_arr[$v['dayofweekval']] = intval($v['allnum']);
  151. $currlist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
  152. if(isset($count_arr['curr'])){
  153. $count_arr['curr'] += intval($v['allnum']);
  154. }else{
  155. $count_arr['curr'] = 0;
  156. }
  157. }
  158. }
  159. }
  160. $stat_arr['series'][0]['name'] = lang('last_week');
  161. $stat_arr['series'][0]['data'] = array_values($up_arr);
  162. $stat_arr['series'][1]['name'] = lang('this_week');
  163. $stat_arr['series'][1]['data'] = array_values($curr_arr);
  164. //得到统计图数据
  165. $stat_arr['title'] = lang('new_order_statistics');
  166. $stat_arr['yAxis'] = lang('new_order_count');
  167. $stat_json = getStatData_LineLabels($stat_arr);
  168. View::assign('stat_json_week_order', $stat_json);
  169. }
  170. /**
  171. * 获取本周新增店铺数量
  172. */
  173. private function _get_week_store()
  174. {
  175. $field = ' COUNT(*) as allnum ';
  176. $current_weekarr = getWeek_SdateAndEdate(TIMESTAMP);
  177. $stime = strtotime($current_weekarr['sdate']) - 86400 * 7;
  178. $etime = strtotime($current_weekarr['edate']) + 86400 - 1;
  179. //总计的查询时间
  180. $count_arr['seartime'] = ($stime + 86400 * 7) . '|' . $etime;
  181. $up_week = @date('W', $stime); //上周
  182. $curr_week = @date('W', $etime); //本周
  183. //构造横轴数据
  184. for ($i = 1; $i <= 7; $i++) {
  185. //统计图数据
  186. $up_arr[$i] = 0;
  187. $curr_arr[$i] = 0;
  188. $tmp_weekarr = getSystemWeekArr();
  189. //统计表数据
  190. $currlist_arr[$i]['timetext'] = $tmp_weekarr[$i];
  191. //方便搜索会员列表,计算开始时间和结束时间
  192. $currlist_arr[$i]['stime'] = strtotime($current_weekarr['sdate']) + ($i - 1) * 86400;
  193. $currlist_arr[$i]['etime'] = $currlist_arr[$i]['stime'] + 86400 - 1;
  194. $uplist_arr[$i]['val'] = 0;
  195. $currlist_arr[$i]['val'] = 0;
  196. //横轴
  197. $stat_arr['xAxis']['categories'][] = $tmp_weekarr[$i];
  198. unset($tmp_weekarr);
  199. }
  200. $where = array();
  201. $where[] = array('store_addtime','between', array($stime, $etime));
  202. $field .= ',WEEKOFYEAR(FROM_UNIXTIME(store_addtime)) as weekval,WEEKDAY(FROM_UNIXTIME(store_addtime))+1 as dayofweekval ';
  203. $storelist = Db::name('store')->field($field)->where($where)->group('weekval,dayofweekval')->select()->toArray();
  204. if ($storelist) {
  205. foreach ($storelist as $k => $v) {
  206. if ($up_week == intval($v['weekval'])) {
  207. $up_arr[$v['dayofweekval']] = intval($v['allnum']);
  208. $uplist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
  209. if(isset($count_arr['up'])){
  210. $count_arr['up'] += intval($v['allnum']);
  211. }else{
  212. $count_arr['up'] = 0;
  213. }
  214. }
  215. if ($curr_week == $v['weekval']) {
  216. $curr_arr[$v['dayofweekval']] = intval($v['allnum']);
  217. $currlist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
  218. if(isset($count_arr['curr'])){
  219. $count_arr['curr'] += intval($v['allnum']);
  220. }else{
  221. $count_arr['curr'] = 0;
  222. }
  223. }
  224. }
  225. }
  226. $stat_arr['series'][0]['name'] = lang('last_week');
  227. $stat_arr['series'][0]['data'] = array_values($up_arr);
  228. $stat_arr['series'][1]['name'] = lang('this_week');
  229. $stat_arr['series'][1]['data'] = array_values($curr_arr);
  230. //得到统计图数据
  231. $stat_arr['title'] = lang('new_store_statistics');
  232. $stat_arr['yAxis'] = lang('new_store_count');
  233. $stat_json = getStatData_LineLabels($stat_arr);
  234. View::assign('stat_json_week_store', $stat_json);
  235. }
  236. /**
  237. * 获取本周新增商品数量
  238. */
  239. private function _get_week_goods() {
  240. $field = ' COUNT(*) as allnum ';
  241. $current_weekarr = getWeek_SdateAndEdate(TIMESTAMP);
  242. $stime = strtotime($current_weekarr['sdate']) - 86400 * 7;
  243. $etime = strtotime($current_weekarr['edate']) + 86400 - 1;
  244. //总计的查询时间
  245. $count_arr['seartime'] = ($stime + 86400 * 7) . '|' . $etime;
  246. $up_week = @date('W', $stime); //上周
  247. $curr_week = @date('W', $etime); //本周
  248. //构造横轴数据
  249. for ($i = 1; $i <= 7; $i++) {
  250. //统计图数据
  251. $up_arr[$i] = 0;
  252. $curr_arr[$i] = 0;
  253. $tmp_weekarr = getSystemWeekArr();
  254. //统计表数据
  255. $currlist_arr[$i]['timetext'] = $tmp_weekarr[$i];
  256. //方便搜索会员列表,计算开始时间和结束时间
  257. $currlist_arr[$i]['stime'] = strtotime($current_weekarr['sdate']) + ($i - 1) * 86400;
  258. $currlist_arr[$i]['etime'] = $currlist_arr[$i]['stime'] + 86400 - 1;
  259. $uplist_arr[$i]['val'] = 0;
  260. $currlist_arr[$i]['val'] = 0;
  261. //横轴
  262. $stat_arr['xAxis']['categories'][] = $tmp_weekarr[$i];
  263. unset($tmp_weekarr);
  264. }
  265. $where = array();
  266. $where[] = array('goods_addtime','between', array($stime, $etime));
  267. $field .= ',WEEKOFYEAR(FROM_UNIXTIME(goods_addtime)) as weekval,WEEKDAY(FROM_UNIXTIME(goods_addtime))+1 as dayofweekval ';
  268. $goodslist = Db::name('goodscommon')->field($field)->where($where)->group('weekval,dayofweekval')->select()->toArray();
  269. if ($goodslist) {
  270. foreach ($goodslist as $k => $v) {
  271. if ($up_week == intval($v['weekval'])) {
  272. $up_arr[$v['dayofweekval']] = intval($v['allnum']);
  273. $uplist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
  274. if(isset($count_arr['up'])){
  275. $count_arr['up'] += intval($v['allnum']);
  276. }else{
  277. $count_arr['up'] = 0;
  278. }
  279. }
  280. if ($curr_week == $v['weekval']) {
  281. $curr_arr[$v['dayofweekval']] = intval($v['allnum']);
  282. $currlist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
  283. if(isset($count_arr['curr'])){
  284. $count_arr['curr'] += intval($v['allnum']);
  285. }else{
  286. $count_arr['curr'] = 0;
  287. }
  288. }
  289. }
  290. }
  291. $stat_arr['series'][0]['name'] = lang('last_week');
  292. $stat_arr['series'][0]['data'] = array_values($up_arr);
  293. $stat_arr['series'][1]['name'] = lang('this_week');
  294. $stat_arr['series'][1]['data'] = array_values($curr_arr);
  295. //得到统计图数据
  296. $stat_arr['title'] = lang('new_goods_statistics');
  297. $stat_arr['yAxis'] = lang('new_goods_count');
  298. $stat_json = getStatData_LineLabels($stat_arr);
  299. View::assign('stat_json_week_goods', $stat_json);
  300. }
  301. /**
  302. * 获取本周新增会员数量
  303. */
  304. private function _get_week_member() {
  305. $field = ' COUNT(*) as allnum ';
  306. $current_weekarr = getWeek_SdateAndEdate(TIMESTAMP);
  307. $stime = strtotime($current_weekarr['sdate']) - 86400 * 7;
  308. $etime = strtotime($current_weekarr['edate']) + 86400 - 1;
  309. //总计的查询时间
  310. $count_arr['seartime'] = ($stime + 86400 * 7) . '|' . $etime;
  311. $up_week = @date('W', $stime); //上周
  312. $curr_week = @date('W', $etime); //本周
  313. //构造横轴数据
  314. for ($i = 1; $i <= 7; $i++) {
  315. //统计图数据
  316. $up_arr[$i] = 0;
  317. $curr_arr[$i] = 0;
  318. $tmp_weekarr = getSystemWeekArr();
  319. //统计表数据
  320. $currlist_arr[$i]['timetext'] = $tmp_weekarr[$i];
  321. //方便搜索会员列表,计算开始时间和结束时间
  322. $currlist_arr[$i]['stime'] = strtotime($current_weekarr['sdate']) + ($i - 1) * 86400;
  323. $currlist_arr[$i]['etime'] = $currlist_arr[$i]['stime'] + 86400 - 1;
  324. $uplist_arr[$i]['val'] = 0;
  325. $currlist_arr[$i]['val'] = 0;
  326. //横轴
  327. $stat_arr['xAxis']['categories'][] = $tmp_weekarr[$i];
  328. unset($tmp_weekarr);
  329. }
  330. $where = array();
  331. $where[] = array('member_addtime','between', array($stime, $etime));
  332. $field .= ',WEEKOFYEAR(FROM_UNIXTIME(member_addtime)) as weekval,WEEKDAY(FROM_UNIXTIME(member_addtime))+1 as dayofweekval ';
  333. $memberlist = Db::name('member')->field($field)->where($where)->group('weekval,dayofweekval')->select()->toArray();
  334. if ($memberlist) {
  335. foreach ($memberlist as $k => $v) {
  336. if ($up_week == intval($v['weekval'])) {
  337. $up_arr[$v['dayofweekval']] = intval($v['allnum']);
  338. $uplist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
  339. if(isset($count_arr['up'])){
  340. $count_arr['up'] += intval($v['allnum']);
  341. }else{
  342. $count_arr['up'] = 0;
  343. }
  344. }
  345. if ($curr_week == $v['weekval']) {
  346. $curr_arr[$v['dayofweekval']] = intval($v['allnum']);
  347. $currlist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
  348. if(isset($count_arr['curr'])){
  349. $count_arr['curr'] += intval($v['allnum']);
  350. }else{
  351. $count_arr['curr'] = 0;
  352. }
  353. }
  354. }
  355. }
  356. $stat_arr['series'][0]['name'] = lang('last_week');
  357. $stat_arr['series'][0]['data'] = array_values($up_arr);
  358. $stat_arr['series'][1]['name'] = lang('this_week');
  359. $stat_arr['series'][1]['data'] = array_values($curr_arr);
  360. //得到统计图数据
  361. $stat_arr['title'] = lang('new_member_statistics');
  362. $stat_arr['yAxis'] = lang('new_member_count');
  363. $stat_json = getStatData_LineLabels($stat_arr);
  364. View::assign('stat_json_week_member', $stat_json);
  365. }
  366. /**
  367. * 获取当前数据库版本
  368. */
  369. private function _mysql_version() {
  370. $version = Db::query("select version() as ver");
  371. return $version[0]['ver'];
  372. }
  373. function aboutus() {
  374. $this->setAdminCurItem('aboutus');
  375. return View::fetch();
  376. }
  377. /**
  378. * 统计
  379. */
  380. public function statistics() {
  381. $statistics = array();
  382. // 本周开始时间点
  383. $tmp_time = mktime(0, 0, 0, date('m'), date('d'), date('Y')) - (date('w') == 0 ? 7 : date('w') - 1) * 24 * 60 * 60;
  384. /**
  385. * 会员
  386. */
  387. $member_model = model('member');
  388. // 会员总数
  389. $statistics['member'] = $member_model->getMemberCount(array());
  390. // 新增会员数
  391. $statistics['week_add_member'] = $member_model->getMemberCount(array(array('member_addtime','>=', $tmp_time)));
  392. // 预存款提现
  393. $statistics['cashlist'] = model('predeposit')->getPdcashCount(array('pdc_payment_state' => 0));
  394. // 会员认证
  395. $statistics['member_auth'] = $member_model->getMemberCount(array(array('member_auth_state' ,'=', 1)));
  396. /**
  397. * 店铺
  398. */
  399. $store_model = model('store');
  400. // 店铺总数
  401. $statistics['store'] = model('store')->getStoreCount(array());
  402. // 店铺申请数
  403. $statistics['store_joinin'] = model('storejoinin')->getStorejoininCount(array(array('joinin_state','in', array(10, 11))));
  404. //经营类目申请
  405. $statistics['store_bind_class_applay'] = model('storebindclass')->getStorebindclassCount(array('storebindclass_state' => 0));
  406. //店铺续签申请
  407. $statistics['store_reopen_applay'] = model('storereopen')->getStorereopenCount(array('storereopen_state' => 1));
  408. // 即将到期
  409. $statistics['store_expire'] = $store_model->getStoreCount(array(array('store_state','=',1),array('store_endtime','between',array(TIMESTAMP, TIMESTAMP + 864000))));
  410. // 已经到期
  411. $statistics['store_expired'] = $store_model->getStoreCount(array(array('store_state','=',1),array('store_endtime','between',array(1, TIMESTAMP))));
  412. /**
  413. * 商品
  414. */
  415. $goods_model = model('goods');
  416. // 商品总数
  417. $statistics['goods'] = $goods_model->getGoodsCommonCount(array());
  418. // 新增商品数
  419. $statistics['week_add_product'] = $goods_model->getGoodsCommonCount(array(array('goods_addtime','>=', $tmp_time)));
  420. // 等待审核
  421. $statistics['product_verify'] = $goods_model->getGoodsCommonWaitVerifyCount(array());
  422. // 举报
  423. $statistics['inform_list'] = model('inform')->getInformCount(array('inform_state' => 1));
  424. // 品牌申请
  425. $statistics['brand_apply'] = model('brand')->getBrandCount(array('brand_apply' => '0'));
  426. /**
  427. * 交易
  428. */
  429. $order_model = model('order');
  430. $refundreturn_model = model('refundreturn');
  431. $vrrefund_model = model('vrrefund');
  432. $complain_model = model('complain');
  433. // 订单总数
  434. $statistics['order'] = $order_model->getOrderCount(array());
  435. // 退款
  436. $statistics['refund'] = $refundreturn_model->getRefundreturnCount(array('refund_type' => 1, 'refund_state' => 2));
  437. // 退货
  438. $statistics['return'] = $refundreturn_model->getRefundreturnCount(array('refund_type' => 2, 'refund_state' => 2));
  439. // 虚拟订单退款
  440. $statistics['vr_refund'] = $vrrefund_model->getVrrefundCount(array('admin_state' => 1));
  441. // 投诉
  442. $statistics['complain_new_list'] = $complain_model->getComplainCount(array('complain_state' => 10));
  443. // 待仲裁
  444. $statistics['complain_handle_list'] = $complain_model->getComplainCount(array('complain_state' => 40));
  445. /**
  446. * 运营
  447. */
  448. // 抢购数量
  449. $statistics['groupbuy_verify_list'] = model('groupbuy')->getGroupbuyCount(array('groupbuy_state' => 10));
  450. // 积分订单
  451. $pointsorder_model = model('pointorder');
  452. $condition =array();
  453. $condition =array(array('point_orderstate','in', array(11, 20)));
  454. $statistics['points_order'] = $pointsorder_model->getPointorderCount($condition);
  455. //待审核账单
  456. $bill_model = model('bill');
  457. $statistics['check_billno'] = $bill_model->getOrderbillCount(array('ob_state'=>BILL_STATE_STORE_COFIRM));
  458. //待支付账单
  459. $statistics['pay_billno'] = $bill_model->getOrderbillCount(array('ob_state'=>BILL_STATE_STORE_COFIRM));
  460. // 平台客服
  461. $statistics['mall_consult'] = model('mallconsult')->getMallconsultCount(array('mallconsult_isreply' => 0));
  462. // 服务站
  463. $statistics['chain'] = model('chain')->getChainWaitVerifyCount(array());
  464. echo json_encode($statistics);
  465. exit;
  466. }
  467. /**
  468. * h5链接
  469. */
  470. public function h5_link(){
  471. return View::fetch();
  472. }
  473. public function h5_activity(){
  474. $activity_model = model('activity');
  475. $keyword=input('param.keyword');
  476. $condition = array();
  477. $condition[] = array('activity_type','=',1); //只显示商品活动
  478. $condition[] = array('activity_state','=',1);
  479. if($keyword){
  480. $condition[] = array('activity_title','like','%'.$keyword.'%');
  481. }
  482. $activity_list = $activity_model->getActivityList($condition, 10 , 'activity_sort asc');
  483. View::assign('show_page', $activity_model->page_info->render());
  484. View::assign('activity_list', $activity_list);
  485. return View::fetch();
  486. }
  487. public function h5_live(){
  488. $condition = array();
  489. $store_model = model('store');
  490. $keyword=input('param.keyword');
  491. if (config('ds_config.live_type') == 1) {
  492. $minipro_live_model = model('minipro_live');
  493. if($keyword){
  494. $condition[] = array('minipro_live_name','like','%'.$keyword.'%');
  495. }
  496. $minipro_live_list = $minipro_live_model->getMiniproLiveList($condition);
  497. $store_list = array();
  498. foreach ($minipro_live_list as $key => $val) {
  499. if (!isset($store_list[$val['store_id']])) {
  500. $store_list[$val['store_id']] = $store_model->getStoreInfo(array('store_id' => $val['store_id']));
  501. }
  502. $minipro_live_list[$key]['store_name'] = $store_list[$val['store_id']]['store_name'] ? $store_list[$val['store_id']]['store_name'] : '';
  503. }
  504. View::assign('minipro_live_list', $minipro_live_list);
  505. View::assign('show_page', $minipro_live_model->page_info->render());
  506. } else {
  507. $live_apply_model = model('live_apply');
  508. $condition[] = array('live_apply_state', '=', 1);
  509. if($keyword){
  510. $condition[] = array('live_apply_name','like','%'.$keyword.'%');
  511. }
  512. $live_apply_list = $live_apply_model->getLiveApplyList($condition, '*', 10, 'live_apply_state asc,live_apply_id desc');
  513. $store_list = array();
  514. foreach ($live_apply_list as $key => $val) {
  515. $live_apply_list[$key]['live_apply_user_name'] = '';
  516. switch ($val['live_apply_user_type']) {
  517. case 2:
  518. if (!isset($store_list[$val['live_apply_user_id']])) {
  519. $store_list[$val['live_apply_user_id']] = $store_model->getStoreInfo(array('store_id' => $val['live_apply_user_id']));
  520. }
  521. $live_apply_list[$key]['live_apply_user_name'] = $store_list[$val['live_apply_user_id']]['store_name'] ? $store_list[$val['live_apply_user_id']]['store_name'] : '';
  522. break;
  523. }
  524. }
  525. View::assign('live_apply_list', $live_apply_list);
  526. View::assign('show_page', $live_apply_model->page_info->render());
  527. }
  528. return View::fetch();
  529. }
  530. public function h5_market(){
  531. $condition = array();
  532. $keyword=input('param.keyword');
  533. $marketmanage_type=intval(input('param.type'));
  534. $condition[]=array('marketmanage_type','=',$marketmanage_type);
  535. if($keyword){
  536. $condition[] = array('marketmanage_name','like','%'.$keyword.'%');
  537. }
  538. $marketmanage_model = model('marketmanage');
  539. $marketmanage_list = $marketmanage_model->getMarketmanageList($condition, 10);
  540. View::assign('marketmanage_list', $marketmanage_list);
  541. View::assign('show_page', $marketmanage_model->page_info->render());
  542. return View::fetch();
  543. }
  544. public function h5_bonus(){
  545. $keyword=input('param.keyword');
  546. $condition = array();
  547. $condition[]=array('bonus_state','=',1);
  548. $condition[]=array('bonus_type','=',1);
  549. if($keyword){
  550. $condition[] = array('bonus_name','like','%'.$keyword.'%');
  551. }
  552. $bonus_model = model('bonus');
  553. $bonus_list = $bonus_model->getBonusList($condition, 10);
  554. View::assign('bonus_list', $bonus_list);
  555. View::assign('show_page', $bonus_model->page_info->render());
  556. return View::fetch();
  557. }
  558. public function h5_special(){
  559. $keyword=input('param.keyword');
  560. $editable_page_model = model('editable_page');
  561. $store_id=intval(input('param.store_id'));
  562. $condition = array();
  563. $condition[]=array('store_id','=',$store_id);
  564. $condition[]=array('editable_page_client','=','h5');
  565. if($keyword){
  566. $condition[] = array('editable_page_name','like','%'.$keyword.'%');
  567. }
  568. $editable_page_list = $editable_page_model->getEditablePageList($condition, 10);
  569. View::assign('show_page', $editable_page_model->page_info->render());
  570. View::assign('editable_page_list', $editable_page_list);
  571. return View::fetch();
  572. }
  573. public function h5_point_prod(){
  574. $keyword=input('param.keyword');
  575. $pointprod_model = model('pointprod');
  576. $condition = array();
  577. $condition[] = array('pgoods_show', '=', 1);
  578. if($keyword){
  579. $condition[] = array('pgoods_name','like','%'.$keyword.'%');
  580. }
  581. $prod_list = $pointprod_model->getPointProdList($condition, '*', 'pgoods_sort asc,pgoods_id desc', 0, 10);
  582. //信息输出
  583. View::assign('prod_list', $prod_list);
  584. View::assign('show_page', $pointprod_model->page_info->render());
  585. return View::fetch();
  586. }
  587. public function h5_article_class(){
  588. if(input('param.ajax')==1){
  589. $articleclass_model = model('articleclass');
  590. $parent_id=intval(input('param.parent_id'));
  591. $condition=array();
  592. $condition[]=array('ac_parent_id','=',$parent_id);
  593. $data=$articleclass_model->getArticleclassList($condition);
  594. ds_json_encode(10000, '', $data);
  595. }else{
  596. return View::fetch();
  597. }
  598. }
  599. public function h5_article(){
  600. $keyword=input('param.keyword');
  601. $article_model = model('article');
  602. $condition=array();
  603. $condition[]=array('article_show','=',1);
  604. if($keyword){
  605. $condition[] = array('article_title','like','%'.$keyword.'%');
  606. }
  607. $article_list = $article_model->getArticleList($condition, 10);
  608. return View::fetch();
  609. }
  610. public function h5_document(){
  611. $condition=array();
  612. $keyword=input('param.keyword');
  613. $document_model = model('document');
  614. if($keyword){
  615. $condition[] = array('document_title','like','%'.$keyword.'%');
  616. }
  617. $doc_list = $document_model->getDocumentList($condition);
  618. View::assign('doc_list', $doc_list);
  619. return View::fetch();
  620. }
  621. public function h5_store_class(){
  622. $storeclass_model = model('storeclass');
  623. $keyword=input('param.keyword');
  624. $store_class_list = $storeclass_model->getStoreclassList(array(), 10);
  625. View::assign('class_list', $store_class_list);
  626. View::assign('show_page', $storeclass_model->page_info->render());
  627. return View::fetch();
  628. }
  629. public function h5_store(){
  630. $keyword=input('param.keyword');
  631. $store_model=model('store');
  632. $condition=array();
  633. $condition[] = array('store_state', '=', 1);
  634. if($keyword){
  635. $condition[] = array('store_name','like','%'.$keyword.'%');
  636. }
  637. $store_list = $store_model->getStoreList($condition, 10, 'store_id desc');
  638. View::assign('store_list', $store_list);
  639. View::assign('show_page', $store_model->page_info->render());
  640. return View::fetch();
  641. }
  642. public function h5_goods_class(){
  643. if(input('param.ajax')==1){
  644. $goodsclass_model = model('goodsclass');
  645. $parent_id=intval(input('param.parent_id'));
  646. $data=$goodsclass_model->getGoodsclassListByParentId($parent_id);
  647. ds_json_encode(10000, '', $data);
  648. }else{
  649. return View::fetch();
  650. }
  651. }
  652. public function h5_goods(){
  653. $keyword=input('param.keyword');
  654. $goods_model = model('goods');
  655. $condition=array();
  656. $condition[]=array('goods_state','=',1);
  657. $condition[]=array('goods_verify','=',1);
  658. if($keyword){
  659. $condition[] = array('goods_name','like','%'.$keyword.'%');
  660. }
  661. $goods_list = $goods_model->getGoodsList($condition, '*', '', '', 0, 10);
  662. View::assign('goods_list', $goods_list);
  663. View::assign('show_page', $goods_model->page_info->render());
  664. return View::fetch();
  665. }
  666. }
  667. ?>