コード例 #1
0
ファイル: coupon_info.php プロジェクト: show123456/taiyou
 public function getCoupon()
 {
     $CouponRecordTable = new Model_ApplistCouponRecord();
     $CouponListTable = new Model_ApplistCouponList();
     $cfromuser = $this->fromuser;
     $customer_id = $this->customer_id;
     //搜索条件
     $filter['where'] = " customer_id='{$customer_id}' and state='1' ";
     $sql = $CouponListTable->select($filter);
     //解析结果集
     $couponInfo = $CouponListTable->fetchRow($sql);
     $filter['where'] = "fromuser='******' and pid='{$couponInfo['id']}'";
     $times = $CouponRecordTable->count($filter);
     //如果领取次数未满
     if ($couponInfo && $couponInfo['end_date'] > date("Y-m-d") && $times < $couponInfo['times'] && $couponInfo['stock'] > $couponInfo['use_num']) {
         //插入领取成功记录
         $data['pid'] = (int) $couponInfo['id'];
         $data['end_date'] = $couponInfo['end_date'];
         $data['state'] = 2;
         $data['customer_id'] = $customer_id;
         $data['fromuser'] = $cfromuser;
         $data['create_date'] = date("Y-m-d H:i:s");
         $data['coupon_name'] = str_inmysql($couponInfo['denomination']);
         $memberTable = new Model_Member();
         $nickname = $memberTable->fetchRow("select nickname from member where fromuser='******' and customer_id='{$customer_id}'");
         $data['nickname'] = $nickname['nickname'];
         $id = $CouponRecordTable->upsert($data);
         $CouponListTable->query("update applist_coupon_list set use_num=use_num+1 where id='{$couponInfo['id']}' and customer_id='{$customer_id}'");
         //获取优惠券 规则信息 返回微信单图文格式
         $CouponTable = new Model_ApplistCoupon();
         $info = $CouponTable->fetchRow("select * from applist_coupon where customer_id='{$customer_id}'");
         //返回微信数据
         $data['msgtype'] = 'news';
         $data['title'] = $info['title'];
         $data['description'] = $info['info'];
         $data['picurl'] = 'http://' . $_SERVER['HTTP_HOST'] . "/data/image_c/" . $info['pic'];
         $data['url'] = 'http://' . $_SERVER['HTTP_HOST'] . "/mobile/coupon/index.php?id=" . $id . "&pid=" . $data['pid'] . "&fromuser="******"&sign=" . $this->timesign;
         return $data;
     } else {
         $data['msgtype'] = "text";
         $data['content'] = $couponInfo['cue'];
         return $data;
     }
 }
コード例 #2
0
ファイル: member_action.php プロジェクト: show123456/taiyou
    $y = $_POST['year'];
    $today = $_POST['year'] . '-' . $_POST['month'] . '-' . date('j', mktime(0, 0, 1, $m == 12 ? 1 : $m + 1, 1, $m == 12 ? $y + 1 : $y) - 24 * 3600);
    //echo $d=die();
    $and = " and left(create_date,10)<='{$today}'";
    $start_date = $today = $_POST['year'] . '-' . $_POST['month'] . '-01';
    $smarty->assign('mon', $m);
    $smarty->assign('yea', $y);
} else {
    $today = date("Y-m-d");
    $start_date = date('Y-m-d', strtotime('-29 day'));
    /* $smarty->assign('mon',date('m'));	
    	$smarty->assign('yea',date('Y'));	 */
}
$and = isset($and) ? $and : '';
$member = new Model_Member();
$data = $member->fetchRow("select * from member where customer_id={$customer_id} and fromuser='******'");
$smarty->assign("list", $data);
$message = new Model_Message();
$result = $message->fetchAll("select msg_content,create_date from message where customer_id='{$customer_id}' and fromuser='******'");
if ($result) {
    //互动关键字和日期
    $smarty->assign('Interactive_recording', $result);
}
//最近30天互动量
$filter['where'] = "customer_id='{$customer_id}' and fromuser='******' and left(create_date,10)>='{$start_date}'{$and}";
$filter['group'] = " left(create_date,10) ";
$sql = $message->select($filter, 'count(id) as count_num,left(create_date,10) as count_date');
$messagearray = $message->fetchAll($sql);
foreach ($messagearray as $key => $row) {
    $countinfoc[$row['count_date']] = $row['count_num'];
    if ($row['count_date'] == $today) {
コード例 #3
0
ファイル: baseapi.php プロジェクト: show123456/taiyou
 private function getMemDetail()
 {
     global $_WGT;
     $memberModel = new Model_Member();
     $rowMem2 = array();
     //是否有权限获取信息
     //if(in_array($this->customer_id,$_WGT['Authen_customer_id'])){
     $sql = "select id,nickname from member where customer_id='" . $this->customer_id . "' and fromuser='******'FromUserName'] . "'";
     $meminfo = $memberModel->fetchRow($sql);
     if (!$meminfo || $meminfo['nickname'] == '') {
         $rowMem2 = $this->getMeminfo($this->post_data['FromUserName']);
     }
     //}
     return $rowMem2;
 }