12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- defined('InShopNC') or exit('Access Invalid!');
- class refill_exception_type
- {
- const EUnKnown = 0; //不确定的
- const EOfficialSN = 1; //错误的流水号,过短,过长,以及风险流水号
- const ERefundOrder = 2; //检测出来的,统付返销
- const EqualOfficialSN = 3; // 相同流水号
- }
- class refill_exceptionModel extends Model
- {
- public function __construct()
- {
- parent::__construct('refill_exception');
- }
- public function getExceptionList($condition, $pagesize = '',$total = 0, $field = '*', $order = 'order_time desc', $limit = '', $master = false)
- {
- $list = $this->table('refill_exception,refill_order')
- ->field($field)->where($condition)
- ->join('inner')->on('refill_exception.order_id=refill_order.order_id')
- ->page($pagesize,$total)->order($order)->limit($limit)->master($master)->select();
- if (empty($list)) return [];
- return $list;
- }
- public function setHandled($exc_id, $update)
- {
- $update['except_state'] = 1;
- return $this->table('refill_exception')->where(['except_id' => $exc_id])->update($update);
- }
- public function add_except($datas)
- {
- return $this->insert($datas);
- }
- public function exist_order($order_sn)
- {
- $item = $this->field('*')->where(['order_sn' => $order_sn])->find();
- return !empty($item);
- }
- public function getAllExceptionOrders($condition)
- {
- $len = 1000;
- $i = 0;
- $orders = [];
- while (true)
- {
- $start = $i * $len;
- $items = $this->table('refill_exception')
- ->where($condition)
- ->order('oper_time desc')
- ->limit("{$start},{$len}")
- ->select();
- $orders = array_merge($orders,$items);
- if (empty($items) || count($items) < $len) {
- break;
- }
- $i++;
- }
- return $orders;
- }
- }
|