orderTest.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: stanley-king
  5. * Date: 2017/1/13
  6. * Time: 下午11:46
  7. */
  8. define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));
  9. require_once (BASE_ROOT_PATH . '/fooder.php');
  10. require_once (BASE_ROOT_PATH . '/helper/util_helper.php');
  11. class orderTest extends PHPUnit_Framework_TestCase
  12. {
  13. public static function setUpBeforeClass()
  14. {
  15. Base::run_util();
  16. }
  17. public static function tearDownAfterClass()
  18. {
  19. }
  20. public static function testSuccess()
  21. {
  22. $model_order = Model('order');
  23. $logic_order = Logic('order');
  24. $condition = array();
  25. $condition['order_state'] = ORDER_STATE_SEND;
  26. $condition['lock_state'] = 0;
  27. //$condition['delay_time'] = array('lt',time() - ORDER_AUTO_RECEIVE_DAY * 86400);
  28. $condition['order_id'] = 6370;
  29. //分批,每批处理100个订单,最多处理5W个订单
  30. $order_list = $model_order->getOrderList($condition, '', '*', 'delay_time asc', 100);
  31. foreach ($order_list as $order_info) {
  32. $result = $logic_order->changeOrderStateReceive($order_info,'system','系统','超期未收货系统自动完成订单');
  33. }
  34. }
  35. public function testSend()
  36. {
  37. $order_sn = '9000000001035202';
  38. $status = 1;
  39. $consign_time = '2017-01-15 18:07:05.0';
  40. $logistics_no = '3322415835338';
  41. $logistics_company = '申通快递';
  42. $express = Model('express')->field('id')->where(array('e_name' => $logistics_company))->select();
  43. if (empty($express) || count($express) == 0) {
  44. echo 'FAIL';
  45. return;
  46. }
  47. $express_id = $express[0]['id'];
  48. $time = strtotime($consign_time);
  49. }
  50. }