|
@@ -12,24 +12,15 @@ use Main\Lib\Core;
|
|
|
|
|
|
class Card
|
|
|
{
|
|
|
- public function test1()
|
|
|
+ public function locknum()
|
|
|
{
|
|
|
- Dever::import('queue');
|
|
|
- return Dever::len(DEVER_PROJECT . '_' . DEVER_APP_NAME . '_' . 'lock');
|
|
|
- }
|
|
|
-
|
|
|
- public function test2()
|
|
|
- {
|
|
|
- $id = Dever::queue('lock1', 11);
|
|
|
+ $len = Dever::queue('test', 'len');
|
|
|
+ $data = Dever::db('youzan/card_list')->state(array('option_status' => 1));
|
|
|
+ if ($data) {
|
|
|
+ foreach ($data as $k => $v) {
|
|
|
|
|
|
- echo 22222;
|
|
|
-
|
|
|
- return $id;
|
|
|
- }
|
|
|
-
|
|
|
- public function test3()
|
|
|
- {
|
|
|
- return Dever::queue('lock1');
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
# 分配优惠券,此处需要做高并发处理
|
|
@@ -45,7 +36,7 @@ class Card
|
|
|
$one = Dever::db('youzan/card_list')->one(array('option_card_id' => $info['id'], 'option_user' => $user));
|
|
|
if (!$one) {
|
|
|
|
|
|
- //$id = Dever::queue('lock');
|
|
|
+ //$id = Dever::queue('card');
|
|
|
$id = false;
|
|
|
if ($id) {
|
|
|
$card = Dever::db('youzan/card_list')->one($id);
|
|
@@ -80,7 +71,7 @@ class Card
|
|
|
$id = Dever::input('id');
|
|
|
$info = Dever::db('youzan/card')->one($id);
|
|
|
if ($info) {
|
|
|
- Core::run($info['project_id'], 'card_create', 'card.createStart', 'card.createEnd', 'youzan', $id, true);
|
|
|
+ Core::run($info['project_id'], 'card_create', 'card.createStart', 'card.createEnd', 'youzan', $id, false);
|
|
|
}
|
|
|
Dever::alert('提交成功,请到优惠券列表中查看');
|
|
|
return;
|
|
@@ -155,8 +146,7 @@ class Card
|
|
|
$update['group_id'] = $data['response']['promocard']['group_id'];
|
|
|
$update['code_url'] = $data['response']['promocard']['fetch_url'];
|
|
|
$update['result'] = json_encode($data);
|
|
|
- $id = Dever::db('youzan/card_list')->insert($update);
|
|
|
- Dever::queue('lock', $id);
|
|
|
+ Dever::db('youzan/card_list')->insert($update);
|
|
|
}
|
|
|
}
|
|
|
|