[TOC]
## 紅天地項目版本
git使用htd1.0分支
git地址:http://106.3.45.149:8090/app/dst
## 測試環境
服務器:47.94.253.81
使用端口:9090
目錄地址:hongtiandi
項目同步方式,本地開發git 提交->服務器拉取最新代碼
數據庫:47.94.253.81上hongtiandi數據庫
## 優惠券功能說明
sql變更
`
ALTER TABLE `ims_wlmerchant_couponlist`
ADD COLUMN `merchant_type` int(11) NOT NULL COMMENT '商戶ID類型 0 全平臺 1 商戶組 2 商戶 3 門店' AFTER `merchantid`,
ADD COLUMN `is_registered_give` int(11) NOT NULL COMMENT '是否新用戶贈送 0 不贈送 1 贈送' AFTER `is_show`,
ADD COLUMN `is_undertake` int(11) NOT NULL COMMENT '承擔方 1 平臺 2 商戶 3門店' AFTER `is_registered_give`;
`
字段說明:
merchant_type:為實現優惠券 商鋪三級聯動,新增優惠券商鋪類型字段,
* 0表示全部用戶組 merchantid 存儲 0
* 1表示 具體商戶組下面全部商鋪 merchantid 存儲組id groupid值
* 2 表示具體商戶merchantid 存儲商戶id
* 3 表示具體門店merchantid 存儲門店ID
is_registered_give:是否新用戶贈送 0 不贈送 、1贈送
is_undertake : 優惠券承擔方 1 平臺 、2商戶 、3門店
## 相關功能簡單說明
1. 優惠券前臺兼容
利用 uniacid 不同 ,區分顯示前臺功能按鈕,示例如下
~~~
### uniacid 不是紅天地正常展示
{if !in_array($_W['uniacid'],['2'])}
...
<span class="tab-label">{if $_W['agentset']['foot']['onename']} {$_W['agentset']['foot']['onename']} {else} 首頁 {/if}
...
{/if}
~~~
2. 入口掃碼 未登錄進入登錄頁面,登錄后跳轉 優惠券列表
~~~
// public/addons/weliam_merchant/plugin/wlcoupon/app/controller/coupon_app.ctrl.php 文件下 couponslist 方法
if(in_array($_W['uniacid'],[2])){
//未登錄 跳轉到登陸頁面
if(empty($_W['uid'])){
//登錄入口url ,因原登錄入口,未注冊提示 手機號未注冊,需要先進入注冊頁面注冊,才能正常登錄,紅天地登錄url 需要偉偉提供
}else{
//跳轉到券列表
header("Location:".app_url('wlcoupon/coupon_app/htdcouponslist'));
die();
}
}
~~~
3. 新用戶登錄 默認發放 贈送優惠券 (注冊時 具體調用方式在協商)
~~~
// public/addons/weliam_merchant/plugin/wlcoupon/app/controller/coupon_app.ctrl.php 文件下 giveCoupon方法
public function giveCoupon($id){
global $_W, $_GPC;
$where = "uniacid = {$_W['uniacid']} AND aid = {$_W['aid']} and is_registered_give = 1 and status = 1 and is_charge = 0 " ;
$where .= " and starttime <= " . time() . " and endtime >= ".time() ;
$couponlist = pdo_fetchall("SELECT * FROM " . tablename('wlmerchant_couponlist') . "WHERE $where");
$return = [];
if(!empty($couponlist)){
foreach ($couponlist as $key => $val){
if ($val['time_type'] == 1) {
$starttime = $val['starttime'];
$endtime = $val['endtime'];
} else {
$starttime = time();
$endtime = time() + ($val['deadline'] * 24 * 3600);
}
$data = array('mid' => $id, 'aid' => $_W['aid'], 'parentid' => $val['id'], 'status' => 1, 'type' => $val['type'], 'title' => $val['title'], 'sub_title' => $val['sub_title'], 'content' => $val['goodsdetail'], 'description' => $val['description'], 'color' => $val['color'], 'starttime' => $starttime, 'endtime' => $endtime, 'createtime' => time(), 'usetimes' => $val['usetimes'], 'concode' => Util::createConcode(4));
$res = wlCoupon::saveMemberCoupons($data);
$return[] = $res;
}
}
if(empty($return)){
return false;
}else{
return true;
}
}
~~~