|
@@ -116,7 +116,6 @@ class Card
|
|
|
|
|
|
$info['expire_notice'] = $info['expire_notice'] - 1;
|
|
|
$info['fixed_begin_term'] = 0;
|
|
|
-
|
|
|
|
|
|
if ($info['fixed_term']) {
|
|
|
$info['date_type'] = 2;
|
|
@@ -172,8 +171,11 @@ class Card
|
|
|
$this->total();
|
|
|
} else {
|
|
|
$info = Dever::db('youzan/card')->one($id);
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ $data['response']['promocard']['group_id'] = 1;
|
|
|
+ $data['response']['promocard']['fetch_url'] = rand(1,100);
|
|
|
+ $data['response']['promocard']['total'] = 100;
|
|
|
+ */
|
|
|
if ($info && isset($data['response']['promocard']['group_id'])) {
|
|
|
$update['card_id'] = $info['id'];
|
|
|
$update['project_id'] = $info['project_id'];
|
|
@@ -183,7 +185,16 @@ class Card
|
|
|
$update['code_url'] = $data['response']['promocard']['fetch_url'];
|
|
|
$update['cdate'] = time();
|
|
|
$update['result'] = json_encode($data);
|
|
|
- Dever::db('youzan/card_list')->insert($update);
|
|
|
+ if (isset($data['response']['promocard']['total']) && $data['response']['promocard']['total'] > 0) {
|
|
|
+ $total = $data['response']['promocard']['total'];
|
|
|
+ for ($i = 1; $i <= $total; $i++) {
|
|
|
+ $update['index'] = $i;
|
|
|
+ Dever::db('youzan/card_list')->insert($update);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $update['index'] = 1;
|
|
|
+ Dever::db('youzan/card_list')->insert($update);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|