Dashboard.php 31 KB

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