//\addons\ewei_shopv2\plugin\app\core\mobile\order\pay.php //member card method if($uniacid == 11){ $sql = "select * from ims_ewei_shop_order where id = $orderid"; $result = pdo_fetchall($sql); $status = $result[0]['status']; if($status == 1){ $sql = "select id from ims_ewei_shop_member_level where uniacid = 11 order by id asc limit 1"; $level_id = pdo_fetchcolumn($sql); //month card goodsid $sql = "select count(*) as cnt from ims_ewei_shop_order_goods where orderid = $orderid and goodsid = 301"; $month_card_cnt = pdo_fetchcolumn($sql); //quarter card goodsid $sql = "select count(*) as cnt from ims_ewei_shop_order_goods where orderid = $orderid and goodsid = 300"; $quarter_card_cnt = pdo_fetchcolumn($sql); //year card goodsid $sql = "select count(*) as cnt from ims_ewei_shop_order_goods where orderid = $orderid and goodsid = 268"; $year_card_cnt = pdo_fetchcolumn($sql); $level_expiry_time = date('Y-m-d H:i:s'); if($month_card_cnt > 0){ $sql = "select DATE_ADD(now(),INTERVAL 1 MONTH) as level_expiry_time"; $level_expiry_time = pdo_fetchcolumn($sql); }else if($quarter_card_cnt > 0){ $sql = "select DATE_ADD(now(),INTERVAL 3 MONTH) as level_expiry_time"; $level_expiry_time = pdo_fetchcolumn($sql); }else if($year_card_cnt > 0){ $sql = "select DATE_ADD(now(),INTERVAL 1 YEAR) as level_expiry_time"; $level_expiry_time = pdo_fetchcolumn($sql); } //check if order id duplicate, not update $sql = "select level_card_order_id from ims_ewei_shop_member where uniacid = 11 and openid='$openid'"; $level_card_order_id = pdo_fetchcolumn($sql); if($level_card_order_id != $orderid){ //update level expiry time and level and member card order id pdo_update("ewei_shop_member", array( "level_expiry_time" => $level_expiry_time, "level" => $level_id, "level_card_order_id" => $orderid ), array( "uniacid"=>11, "openid" => $openid )); } } }
addons\ewei_shopv2\plugin\app\core\mobile\wxapp.php
// check member card expiry if($_W['uniacid'] == 11 && !empty($openid)){ $sql = "UPDATE ims_ewei_shop_member SET level_expiry_time=NULL, level=0, level_card_order_id=NULL WHERE level_expiry_time is not NULL AND level_expiry_time <= NOW() AND openid = '$openid'"; pdo_query($sql); }