OrderdistributionController.class.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  1. <?php
  2. /**
  3. * lionfish 商城系统
  4. *
  5. * ==========================================================================
  6. * @link http://www.liofis.com/
  7. * @copyright Copyright (c) 2015 liofis.com.
  8. * @license http://www.liofis.com/license.html License
  9. * ==========================================================================
  10. *
  11. * @author fish
  12. *
  13. */
  14. namespace Seller\Controller;
  15. class OrderdistributionController extends CommonController{
  16. protected function _initialize(){
  17. parent::_initialize();
  18. }
  19. public function index()
  20. {
  21. $pindex = I('request.page', 1);
  22. $psize = 20;
  23. $keyword = I('request.keyword');
  24. $this->keyword = $keyword;
  25. $condition = "";
  26. if (!empty($keyword)) {
  27. $condition .= ' and (a.username like "%'.$keyword.'%" or a.mobile like "%'.$keyword.'%" )';
  28. }
  29. if (defined('ROLE') && ROLE == 'agenter' )
  30. {
  31. $supper_info = get_agent_logininfo();
  32. $condition .= ' and store_id='.$supper_info['id'];
  33. }
  34. $enabled = I('request.state',-1);
  35. if (isset($enabled) && $enabled >= 0) {
  36. $condition .= ' and a.state = ' . $enabled;
  37. } else {
  38. $enabled = -1;
  39. }
  40. $this->enabled = $enabled;
  41. $list = M()->query('SELECT a.*,b.storename FROM ' . C('DB_PREFIX'). "lionfish_comshop_orderdistribution a"
  42. . " left join ".C('DB_PREFIX')."lionfish_comshop_supply b on a.store_id=b.id "
  43. . " WHERE 1=1 "
  44. . $condition . ' order by a.id desc limit ' . (($pindex - 1) * $psize) . ',' . $psize);
  45. if( !empty($list) )
  46. {
  47. foreach( $list as $key => $val )
  48. {
  49. $mb_info = M('lionfish_comshop_member')->field('member_id, username as nickname,avatar')->where( array('member_id' => $val['member_id'] ) )->find();
  50. $val['mb_info'] = $mb_info;
  51. $list[$key] = $val;
  52. }
  53. }
  54. $total = M('lionfish_comshop_orderdistribution a')->where("1=1 ".$condition)->count();
  55. $pager = pagination2($total, $pindex, $psize);
  56. $this->list = $list;
  57. $this->pager = $pager;
  58. $this->display();
  59. }
  60. /**
  61. * 提现列表
  62. */
  63. public function withdrawallist()
  64. {
  65. $_GPC = I('request.');
  66. $condition = ' ';
  67. $pindex = max(1, intval($_GPC['page']));
  68. $psize = 20;
  69. if (!empty($_GPC['keyword'])) {
  70. $_GPC['keyword'] = trim($_GPC['keyword']);
  71. $condition .= ' and ( o.id = '.intval($_GPC['keyword']).') ';
  72. }
  73. $store_id = 0;
  74. $is_supply_status = 0;
  75. if (defined('ROLE') && ROLE == 'agenter' )
  76. {
  77. $supper_info = get_agent_logininfo();
  78. $store_id = $supper_info['id'];
  79. $condition .= ' and co.store_id='.$store_id;
  80. $is_supply_status = 1;
  81. }
  82. $starttime = strtotime( date('Y-m-d')." 00:00:00" );
  83. $endtime = $starttime + 86400;
  84. if (!empty($_GPC['time']['start']) && !empty($_GPC['time']['end'])) {
  85. $starttime = strtotime($_GPC['time']['start']);
  86. $endtime = strtotime($_GPC['time']['end']);
  87. $condition .= ' AND o.addtime >= '.$starttime.' AND o.addtime <= '.$endtime.' ';
  88. }
  89. $this->starttime = $starttime;
  90. $this->endtime = $endtime;
  91. if ($_GPC['comsiss_state'] != '') {
  92. $condition .= ' and o.state=' . intval($_GPC['comsiss_state']);
  93. }
  94. $sql = 'SELECT o.*,co.username FROM ' . C('DB_PREFIX') . "lionfish_comshop_orderdistribution_tixian_order o left join ".C('DB_PREFIX')."lionfish_comshop_orderdistribution co on o.member_id=co.member_id "
  95. . "WHERE 1 " . $condition . ' order by o.id desc ';
  96. if (empty($_GPC['export'])) {
  97. $sql .= ' limit ' . (($pindex - 1) * $psize) . ',' . $psize;
  98. }
  99. $community_tixian_fee = D('Home/Front')->get_config_by_name('distribution_tixian_fee');
  100. //echo $sql.'<br/>';
  101. $list = M()->query($sql);
  102. $total_arr = M()->query('SELECT count(1) as count FROM ' . C('DB_PREFIX') . 'lionfish_comshop_orderdistribution_tixian_order o left join '.C("DB_PREFIX").'lionfish_comshop_orderdistribution co on o.member_id=co.member_id WHERE 1 ' . $condition );
  103. $total = $total_arr[0]['count'];
  104. foreach( $list as $key => $val )
  105. {
  106. //普通等级
  107. $member_info = M('lionfish_comshop_member')->field('username,avatar,we_openid,telephone')->where( array('member_id' => $val['member_id'] ) )->find();
  108. $val['member_info'] = $member_info;
  109. $list[$key] = $val;
  110. }
  111. if ($_GPC['export'] == '1') {
  112. foreach($list as $key =>&$row)
  113. {
  114. $row['username'] = $row['member_info']['username'];
  115. $row['telephone'] = $row['member_info']['telephone'];
  116. $row['bankname'] = $row['bankname'];
  117. if( $row['type'] == 1 )
  118. {
  119. $row['bankname'] = '余额';
  120. }elseif( $row['type'] == 2 ){
  121. $row['bankname'] = '微信零钱';
  122. }elseif($row['type'] == 3){
  123. $row['bankname'] = '支付宝';
  124. }
  125. $row['bankaccount'] = "\t".$row['bankaccount'];
  126. $row['bankusername'] = $row['bankusername'];
  127. $row['get_money'] = $row['money']-$row['service_charge_money'];
  128. $row['addtime'] = date('Y-m-d H:i:s', $row['addtime']);
  129. if(!empty($row['shentime']))
  130. {
  131. $row['shentime'] = date('Y-m-d H:i:s', $row['shentime']);
  132. }
  133. if($row['state'] ==0)
  134. {
  135. $row['state'] = '待审核';
  136. }else if($row[state] ==1)
  137. {
  138. $row['state'] = '已审核,打款';
  139. }else if($row[state] ==2){
  140. $row['state'] = '已拒绝';
  141. }
  142. }
  143. unset($row);
  144. $columns = array(
  145. array('title' => 'ID', 'field' => 'id', 'width' => 12),
  146. array('title' => '用户名', 'field' => 'username', 'width' => 12),
  147. array('title' => '联系方式', 'field' => 'telephone', 'width' => 12),
  148. array('title' => '打款银行', 'field' => 'bankname', 'width' => 24),
  149. array('title' => '打款账户', 'field' => 'bankaccount', 'width' => 24),
  150. array('title' => '真实姓名', 'field' => 'bankusername', 'width' => 24),
  151. array('title' => '申请提现金额', 'field' => 'money', 'width' => 24),
  152. array('title' => '手续费', 'field' => 'service_charge_money', 'width' => 24),
  153. array('title' => '到账金额', 'field' => 'get_money', 'width' => 24),
  154. array('title' => '申请时间', 'field' => 'addtime', 'width' => 24),
  155. array('title' => '审核时间', 'field' => 'shentime', 'width' => 24),
  156. array('title' => '状态', 'field' => 'state', 'width' => 24)
  157. );
  158. D('Seller/Excel')->export($list, array('title' => '配送员佣金提现数据-' . date('Y-m-d-H-i', time()), 'columns' => $columns));
  159. }
  160. $pager = pagination2($total, $pindex, $psize);
  161. $this->list = $list;
  162. $this->pager = $pager;
  163. $this->_GPC = $_GPC;
  164. $this->is_supply_status = $is_supply_status;
  165. $this->display();
  166. }
  167. public function agent_check_apply()
  168. {
  169. $_GPC = I('request.');
  170. $commission_model = D('Home/LocaltownDelivery');
  171. $id = intval($_GPC['id']);
  172. if (empty($id)) {
  173. $id = (is_array($_GPC['ids']) ? implode(',', $_GPC['ids']) : 0);
  174. }
  175. $comsiss_state = intval($_GPC['state']);
  176. $apply_list = M('lionfish_comshop_orderdistribution_tixian_order')->where('id in( ' . $id . ' )')->select();
  177. $time = time();
  178. //var_dump($members,$comsiss_state);die();
  179. foreach ($apply_list as $apply) {
  180. if ($apply['state'] == $comsiss_state || $apply['state'] == 1 || $apply['state'] == 2) {
  181. continue;
  182. }
  183. $money = $apply['money'];
  184. if ($comsiss_state == 1) {
  185. switch( $apply['type'] )
  186. {
  187. case 1:
  188. $result = $commission_model->send_apply_yuer( $apply['id'] );
  189. break;
  190. case 2:
  191. $result = $commission_model->send_apply_weixin_yuer( $apply['id'] );
  192. break;
  193. case 3:
  194. $result = $commission_model->send_apply_alipay_bank( $apply['id'] );
  195. break;
  196. case 4:
  197. $result = $commission_model->send_apply_alipay_bank( $apply['id'] );
  198. break;
  199. }
  200. if( $result['code'] == 1)
  201. {
  202. show_json(0, array('url' => $_SERVER['HTTP_REFERER'] ,'message'=>$result['msg'] ) );
  203. die();
  204. }
  205. //检测是否存在账户,没有就新建
  206. //TODO....检测是否微信提现到零钱,如果是,那么就准备打款吧
  207. //$commission_model->send_apply_success_msg($apply['id']);
  208. }
  209. else if ($comsiss_state == 2) {
  210. M('lionfish_comshop_orderdistribution_tixian_order')->where( array('id' => $apply['id'] ) )->save( array('state' => 2, 'shentime' => $time) );
  211. //退回冻结的货款
  212. M('lionfish_comshop_orderdistribution_commiss')->where( array('member_id' => $apply['member_id'] ) )->setInc('money',$money);
  213. M('lionfish_comshop_orderdistribution_commiss')->where( array('member_id' => $apply['member_id'] ) )->setInc('dongmoney',-$money);
  214. }
  215. else {
  216. M('lionfish_comshop_orderdistribution_tixian_order')->where( array('id' => $apply['id']) )->save( array('state' => 0, 'shentime' => 0) );
  217. }
  218. }
  219. show_json(1, array('url' => $_SERVER['HTTP_REFERER'] ));
  220. }
  221. public function withdrawalconfig()
  222. {
  223. $_GPC = I('request.');
  224. $supply_id = 0;
  225. if (defined('ROLE') && ROLE == 'agenter' )
  226. {
  227. $supper_info = get_agent_logininfo();
  228. $supply_id = $supper_info['id'];
  229. }
  230. if (IS_POST) {
  231. $data = ((is_array($_GPC['data']) ? $_GPC['data'] : array()));
  232. $data['distribution_tixianway_yuer'] = isset($data['distribution_tixianway_yuer']) ? $data['distribution_tixianway_yuer']:1;
  233. $data['distribution_tixianway_weixin'] = isset($data['distribution_tixianway_weixin']) ? $data['distribution_tixianway_weixin']:1;
  234. $data['distribution_tixianway_alipay'] = isset($data['distribution_tixianway_alipay']) ? $data['distribution_tixianway_alipay']:1;
  235. $data['distribution_tixianway_bank'] = isset($data['distribution_tixianway_bank']) ? $data['distribution_tixianway_bank']:1;
  236. $data['distribution_tixian_publish'] = isset($data['distribution_tixian_publish']) ? $data['distribution_tixian_publish']:'';
  237. if($supply_id == 0){
  238. D('Seller/Config')->update($data);
  239. }else if($supply_id > 0){
  240. D('Seller/SupplyConfig')->update($data);
  241. }
  242. show_json(1, array('url' => $_SERVER['HTTP_REFERER']) );
  243. die();
  244. }
  245. if($supply_id == 0){
  246. $data = D('Seller/Config')->get_all_config();
  247. }else if($supply_id > 0){
  248. $data = D('Seller/SupplyConfig')->get_all_config();
  249. }
  250. $this->supply_id = $supply_id;
  251. $this->data = $data;
  252. $this->display();
  253. }
  254. /**
  255. * 改变状态
  256. */
  257. public function change()
  258. {
  259. $id = I('request.id');
  260. //ids
  261. if (empty($id)) {
  262. $ids = I('request.ids');
  263. $id = ((is_array($ids) ? implode(',', $ids) : 0));
  264. }
  265. if (empty($id)) {
  266. show_json(0, array('message' => '参数错误'));
  267. }
  268. $type = I('request.type');
  269. $value = I('request.value');
  270. if (!(in_array($type, array('state')))) {
  271. show_json(0, array('message' => '参数错误'));
  272. }
  273. $items = M('lionfish_comshop_orderdistribution')->where( array('id' => array('in', $id) ) )->select();
  274. foreach ($items as $item) {
  275. M('lionfish_comshop_orderdistribution')->where( array('id' => $item['id']) )->save( array('state' => $value) );
  276. }
  277. show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
  278. }
  279. public function deletedistribution()
  280. {
  281. $id = I('request.id');
  282. if (empty($id)) {
  283. $ids = I('request.ids');
  284. $id = (is_array($ids) ? implode(',', $ids) : 0);
  285. }
  286. $items = M('lionfish_comshop_orderdistribution')->field('id')->where( array('id' => array('in', $id) ) )->select();
  287. if (empty($item)) {
  288. $item = array();
  289. }
  290. foreach ($items as $item) {
  291. if($item['has_send_count'] <= 0)
  292. M('lionfish_comshop_orderdistribution')->where( array('id' => $item['id']) )->delete();
  293. }
  294. show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
  295. }
  296. public function adddistribution()
  297. {
  298. if (IS_POST) {
  299. $id = I('post.id');
  300. if( empty($id) )
  301. {
  302. $id = 0;
  303. }
  304. $data = array();
  305. $data['username'] = I('post.username');
  306. $data['mobile'] = I('post.mobile');
  307. $data['member_id'] = I('post.member_id');
  308. $data['state'] = I('post.state');
  309. $data['always_address'] = I('post.always_address');
  310. if( empty($data['username']) )
  311. {
  312. show_json(0, array('message' => '请填写配送员姓名'));
  313. }
  314. if( empty($data['mobile']) )
  315. {
  316. show_json(0, array('message' => '请填写手机号'));
  317. }
  318. if( empty($data['member_id']) )
  319. {
  320. show_json(0, array('message' => '请选择关联会员'));
  321. }
  322. if (defined('ROLE') && ROLE == 'agenter' )
  323. {
  324. $supper_info = get_agent_logininfo();
  325. $data['store_id'] = $supper_info['id'];
  326. }
  327. //检测配送员是否关联过了
  328. $ck_pes = M('lionfish_comshop_orderdistribution')->where( "member_id=".$data['member_id']." and id != " .$id )->find();
  329. if( !empty($ck_pes) )
  330. {
  331. show_json(0, array('message' => '该会员已经关联配送员,请选择其他会员'));
  332. }
  333. if( $id > 0 )
  334. {
  335. M('lionfish_comshop_orderdistribution')->where( array('id' => $id) )->save( $data );
  336. }else{
  337. $data['has_send_count'] = 0;
  338. $data['addtime'] = time();
  339. M('lionfish_comshop_orderdistribution')->add( $data );
  340. }
  341. show_json(1, array('url' => U('Orderdistribution/index')));
  342. }
  343. $id = I('get.id', 'intval',0);
  344. if( $id > 0 )
  345. {
  346. $store_id = 0;
  347. $distribution = array();
  348. if (defined('ROLE') && ROLE == 'agenter' )
  349. {
  350. $supper_info = get_agent_logininfo();
  351. $store_id = $supper_info['id'];
  352. $distribution = M('lionfish_comshop_orderdistribution')->where( array('id' => $id,'store_id'=>$store_id) )->find();
  353. }else{
  354. $distribution = M('lionfish_comshop_orderdistribution')->where( array('id' => $id) )->find();
  355. }
  356. $this->distribution = $distribution;
  357. $saler = M('lionfish_comshop_member')->field('member_id, username as nickname,avatar')->where( array('member_id' => $distribution['member_id'] ) )->find();
  358. $saler['username'] = str_replace("'","",$saler['username']);
  359. $saler['nickname'] = str_replace("'","",$saler['nickname']);
  360. $this->saler = $saler;
  361. }
  362. $this->display();
  363. }
  364. /**
  365. * fish
  366. * 同城配送配置方法
  367. */
  368. public function distributionconfig()
  369. {
  370. $supply_id = 0;
  371. if (defined('ROLE') && ROLE == 'agenter' )
  372. {
  373. $supper_info = get_agent_logininfo();
  374. $supply_id = $supper_info['id'];
  375. }
  376. if (IS_POST) {
  377. $data = I('post.data', array());
  378. $data['goods_stock_notice'] = trim($data['goods_stock_notice']);
  379. $data['goods_details_title_bg'] = save_media($data['goods_details_title_bg']);
  380. if($supply_id > 0){
  381. D('Seller/SupplyConfig')->update($data);
  382. }else{
  383. D('Seller/Config')->update($data);
  384. }
  385. show_json(1, array('url'=> U('Orderdistribution/distributionconfig')));
  386. }
  387. if($supply_id > 0){
  388. $data = D('Seller/SupplyConfig')->get_all_config();
  389. }else{
  390. $data = D('Seller/Config')->get_all_config();
  391. }
  392. $this->data = $data;
  393. $this->display();
  394. }
  395. /**
  396. * 选择配送员
  397. */
  398. public function choosemember()
  399. {
  400. $_GPC = I('request.');
  401. $kwd = trim($_GPC['keyword']);
  402. $order_id = $_GPC['id'];
  403. $is_ajax = isset($_GPC['is_ajax']) ? intval($_GPC['is_ajax']) : 0;
  404. $order_info = M('lionfish_comshop_order')->where( array('order_id' => $order_id ) )->find();
  405. $params = array();
  406. $condition = ' 1 ';
  407. if (!empty($kwd)) {
  408. $condition .= ' and ( username LIKE "%'.$kwd .'%" or mobile like "%'.$kwd .'%" )';
  409. }
  410. if($order_info['store_id'] > 0){
  411. $condition .= ' and store_id='.$order_info['store_id'];
  412. }else{
  413. $condition .= ' and store_id=0';
  414. }
  415. /**
  416. 分页开始
  417. **/
  418. $page = isset($_GPC['page']) ? intval($_GPC['page']) : 1;
  419. $page = max(1, $page);
  420. $page_size = 10;
  421. /**
  422. 分页结束
  423. **/
  424. $ds = M()->query('SELECT * FROM ' . C('DB_PREFIX') . 'lionfish_comshop_orderdistribution where '
  425. . $condition .
  426. ' order by id asc' .' limit ' . (($page - 1) * $page_size) . ',' . $page_size );
  427. $total_arr = M()->query('SELECT count(1) as count FROM ' . C('DB_PREFIX') .
  428. 'lionfish_comshop_orderdistribution WHERE ' . $condition );
  429. $total = $total_arr[0]['count'];
  430. foreach ($ds as &$value) {
  431. if($is_ajax == 1)
  432. {
  433. $ret_html .= '<tr>';
  434. $ret_html .= ' <td>'. $value['username'].'</td>';
  435. $ret_html .= ' <td>'.$value['mobile'].'</td>';
  436. $ret_html .= ' <td style="width:80px;"><a href="javascript:;" class="choose_dan_link" data-json=\''.json_encode($value).'\'>选择</a></td>';
  437. $ret_html .= '</tr>';
  438. }
  439. }
  440. $pager = pagination($total, $page, $page_size,'',$context = array('before' => 5, 'after' => 4, 'isajax' => 1));
  441. if( $is_ajax == 1 )
  442. {
  443. echo json_encode( array('code' => 0, 'html' => $ret_html,'pager' => $pager) );
  444. die();
  445. }
  446. $this->ds = $ds;
  447. $this->id = $order_id;
  448. $this->pager = $pager;
  449. unset($value);
  450. if ($_GPC['suggest']) {
  451. exit(json_encode(array('value' => $ds)));
  452. }
  453. $this->display();
  454. }
  455. /**
  456. * 后台配送单选择配送员
  457. */
  458. public function sub_orderchoose_distribution()
  459. {
  460. $order_id = I('post.order_id', 0);
  461. $id = I('post.id', 0);
  462. if( $order_id <=0 || $id <=0 )
  463. {
  464. show_json(0 , array('message' => '数据不合法') );
  465. }
  466. $res = D('Home/LocaltownDelivery')-> distribution_get_order( $id , $order_id);
  467. if($res)
  468. {
  469. show_json(1 , array('message' => '分配成功') );
  470. }else{
  471. show_json(0 , array('message' => '已被分配,请刷新页面') );
  472. }
  473. }
  474. public function distribution_list()
  475. {
  476. $_GPC = I('request.');
  477. $pindex = I('request.page', 1);
  478. $psize = 20;
  479. $id = I('request.id');
  480. $condition = "";
  481. //$condition .= ' and a.orderdistribution_id = '.$id." and is_statement = 1";
  482. $condition .= ' and a.orderdistribution_id = '.$id." ";
  483. $order_no = trim($_GPC['order_no']);
  484. if (!empty($order_no)) {
  485. $condition .= " and o.order_num_alias='".$order_no."'";
  486. }
  487. $list = M()->query("SELECT a.*,o.order_num_alias,o.date_added FROM " . C('DB_PREFIX'). "lionfish_comshop_orderdistribution_order a "
  488. . " left join " . C('DB_PREFIX'). "lionfish_comshop_order o on a.order_id=o.order_id "
  489. . " WHERE 1=1 " . $condition . ' order by a.id desc limit ' . (($pindex - 1) * $psize) . ',' . $psize);
  490. if( !empty($list) )
  491. {
  492. foreach( $list as $key => $val )
  493. {
  494. //配送员名称
  495. $distribution_info = M('lionfish_comshop_orderdistribution')->field('username')->where( array('id' => $val['orderdistribution_id'] ) )->find();
  496. $val['username'] = $distribution_info['username'];
  497. //下单时间
  498. $val['date_added'] = date('Y-m-d H:i:s',$val['date_added']);
  499. //抢单时间
  500. $order_log = M('lionfish_comshop_orderdistribution_log')->field('addtime')->where( array('order_id' => $val['order_id'],'state'=> 2) )->find();
  501. if(!empty($order_log['addtime'])) {
  502. $val['rob_time'] = date('Y-m-d H:i:s', $order_log['addtime']);
  503. }
  504. //取货时间
  505. $order_log = M('lionfish_comshop_orderdistribution_log')->field('addtime')->where( array('order_id' => $val['order_id'],'state'=> 3) )->find();
  506. if(!empty($order_log['addtime'])) {
  507. $val['receive_time'] = date('Y-m-d H:i:s', $order_log['addtime']);
  508. }
  509. //完成时间
  510. $order_log = M('lionfish_comshop_orderdistribution_log')->field('addtime')->where( array('order_id' => $val['order_id'],'state'=> 4) )->find();
  511. if(!empty($order_log['addtime'])){
  512. $val['finish_time'] = date('Y-m-d H:i:s',$order_log['addtime']);
  513. }
  514. $list[$key] = $val;
  515. }
  516. }
  517. $count_list = M()->query("SELECT count(1) as count FROM " . C('DB_PREFIX'). "lionfish_comshop_orderdistribution_order a "
  518. . " left join " . C('DB_PREFIX'). "lionfish_comshop_order o on a.order_id=o.order_id "
  519. . " WHERE 1=1 " . $condition);
  520. $total = $count_list[0]['count'];
  521. $pager = pagination2($total, $pindex, $psize);
  522. $this->id = $id;
  523. $this->order_no = $order_no;
  524. $this->list = $list;
  525. $this->pager = $pager;
  526. $this->display();
  527. }
  528. }
  529. ?>