|
@@ -1918,3 +1918,21 @@ function anti_analysis($lat, $lng) |
|
@@ -1918,3 +1918,21 @@ function anti_analysis($lat, $lng) |
1918
|
return $tmpInfo; //返回json对象
|
1918
|
return $tmpInfo; //返回json对象
|
1919
|
}
|
1919
|
}
|
1920
|
|
1920
|
|
|
|
1921
|
+//赠送优惠券
|
|
|
1922
|
+function give_as_a_present($user_id, $name)
|
|
|
1923
|
+{
|
|
|
1924
|
+ $is_perfect = Db::name('user')->where(['id' => $user_id])->value('is_perfect');
|
|
|
1925
|
+ if ($is_perfect == 0) {
|
|
|
1926
|
+ $data = Db::name('gift')->where(['id' => 1])->find();
|
|
|
1927
|
+ $present = [
|
|
|
1928
|
+ 'user_id' => $user_id,
|
|
|
1929
|
+ 'discount_coupon_name' => $name,
|
|
|
1930
|
+ 'overflow' => $data['overflow'],
|
|
|
1931
|
+ 'reduce' => $data['reduce'],
|
|
|
1932
|
+ 'deadline' => time() + 30 * 24 * 3600,
|
|
|
1933
|
+ 'status' => 1
|
|
|
1934
|
+ ];
|
|
|
1935
|
+ Db::name('discount_coupon')->insert($present);
|
|
|
1936
|
+ }
|
|
|
1937
|
+}
|
|
|
1938
|
+ |