|
@@ -520,24 +520,30 @@ Class Manage
|
|
|
public function xiu_api()
|
|
|
{
|
|
|
$data = Dever::db('active/order')->state();
|
|
|
- if (!$data['refund_num']) {
|
|
|
- $w['refund_num'] = 0;
|
|
|
- } else {
|
|
|
- $w['refund_num'] =$data['refund_num'];
|
|
|
- }
|
|
|
- if (!$data['code_num'] || $data['code_num'] <= 0) {
|
|
|
- $w['code_num'] = -1;
|
|
|
- }
|
|
|
- if (!$data['no_num']) {
|
|
|
- $w['no_num'] = 0;
|
|
|
+ foreach ($data as $k => $v) {
|
|
|
+ if (!$v['refund_num'] || $v['refund_num']<=0) {
|
|
|
+ $w['refund_num'] = 0;
|
|
|
+ } else {
|
|
|
+ $w['refund_num'] =$v['refund_num'];
|
|
|
+ }
|
|
|
+ if (!$v['code_num'] || $v['code_num'] <= 0) {
|
|
|
+ $w['code_num'] = -1;
|
|
|
+ }
|
|
|
+ if (!$v['no_num']) {
|
|
|
+ $w['no_num'] = 0;
|
|
|
+ }
|
|
|
+ #已使用的数量
|
|
|
+ $code = Dever::db('active/code')->getCode(array('order_id'=>$v['id'],'status'=>'1,2'));
|
|
|
+ $w['code_num'] = count($code);
|
|
|
+ if ($w['code_num'] == 0) {
|
|
|
+ $w['code_num'] = -1;
|
|
|
+ }
|
|
|
+ #待核销的数量
|
|
|
+ $no_code = Dever::db('active/code')->getCode(array('order_id'=>$v['id'],'status'=>1));
|
|
|
+ $w['no_num'] = count($no_code);
|
|
|
+ $w['where_id'] = $v['id'];
|
|
|
+ Dever::db('active/order')->update($w);
|
|
|
}
|
|
|
- #已使用的数量
|
|
|
- $code = Dever::db('active/code')->getCode(array('order_id'=>$data['id'],'status'=>'1,2'));
|
|
|
- $w['code_num'] = count($code);
|
|
|
- #待核销的数量
|
|
|
- $no_code = Dever::db('active/code')->getCode(array('order_id'=>$data['id'],'status'=>1));
|
|
|
- $w['no_num'] = count($no_code);
|
|
|
- $w['where_id'] = $data['id'];
|
|
|
- Dever::db('active/order')->update($w);
|
|
|
+ return 'ok';
|
|
|
}
|
|
|
}
|