...
|
...
|
@@ -1918,3 +1918,21 @@ function anti_analysis($lat, $lng) |
|
|
return $tmpInfo; //返回json对象
|
|
|
}
|
|
|
|
|
|
//赠送优惠券
|
|
|
function give_as_a_present($user_id, $name)
|
|
|
{
|
|
|
$is_perfect = Db::name('user')->where(['id' => $user_id])->value('is_perfect');
|
|
|
if ($is_perfect == 0) {
|
|
|
$data = Db::name('gift')->where(['id' => 1])->find();
|
|
|
$present = [
|
|
|
'user_id' => $user_id,
|
|
|
'discount_coupon_name' => $name,
|
|
|
'overflow' => $data['overflow'],
|
|
|
'reduce' => $data['reduce'],
|
|
|
'deadline' => time() + 30 * 24 * 3600,
|
|
|
'status' => 1
|
|
|
];
|
|
|
Db::name('discount_coupon')->insert($present);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|