Beispiel #1
0
function updateCustomerCount($partner_id)
{
    $customer_count = cloud_get_field('customer_count', 'partners', "id = '{$partner_id}'");
    if (empty($customer_count)) {
        $customers = cloud_get_row('count(*) as count', 'customers', 'partner_id = ' . $partner_id);
        if (!cloud_update('partners', "customer_count ='{$customers['count']}'", 'id = ' . $partner_id)) {
            echo "error1";
        }
    } else {
        if (!cloud_update('partners', 'customer_count = customer_count+1', 'id = ' . $partner_id)) {
            echo "error1";
        }
    }
}
Beispiel #2
0
 require_once '../inc/common_hhr.php';
 $back_url = $_GET['u'];
 $hrr_openid = $_GET['o'];
 $share_id = $_GET['s'];
 $openid = !empty($_SESSION['wx_user']['openid']) ? $_SESSION['wx_user']['openid'] : '123456789';
 $partner_id = cloud_get_field('partner_id', 'partner_wx_infos', " openid ='{$hrr_openid}' AND is_delete = 1 ");
 $time = time();
 $url_data = parse_url($back_url);
 $type = dirname($url_data['path']) == '/goods' ? 2 : 1;
 //2对应是goods,1对应是活动
 $pid = $type == 2 ? get_query('gid', $url_data['query']) : get_query('aid', $url_data['query']);
 //判断是否浏览过
 $is_looked = cloud_get_field('id', 'partner_share_click_record', 'openid = \'' . $openid . '\' AND pid = ' . $pid . ' AND type = ' . $type);
 if (empty($is_looked)) {
     //判断是否已经是其他人的粉丝
     if (!cloud_get_field('id', 'customers_from', "openid = '{$openid}'")) {
         //添加用户粉丝判断
         if (!cloud_insert('customers_from', 'openid,partner_id,type,time', "'{$openid}','{$partner_id}',2,'{$time}'")) {
             echo "error";
             exti;
         }
     }
     //添加浏览记录
     if (!cloud_insert('partner_share_click_record', 'share_id,pid,type,openid,partner_id,back_url,time', "'{$share_id}','{$pid}','{$type}','{$openid}','{$partner_id}','{$back_url}','{$time}'")) {
         echo "error 2";
         exit;
     }
 }
 //echo $back_url;exit;
 //echo "succese";
 header('location:' . $back_url);
Beispiel #3
0
<?php

$res = array('flag' => 0);
if (strpos($_SERVER['HTTP_USER_AGENT'], "MicroMessenger")) {
    require_once '../inc/common_hhr.php';
    $is_reged = cloud_get_field('mobile', 'customers', " mobile = {$_POST['mobile']}");
    if (empty($is_reged)) {
        $openid = $_POST['openid'];
        $realname = $_POST['realname'];
        $sex = $_POST['sex'] == 0 ? 2 : $_POST['sex'];
        //$province_txt=	$_POST['province_txt'];
        //$city_txt	=	$_POST['city_txt'];
        $mobile = $_POST['mobile'];
        $back_url = $_POST['back_url'];
        $createtime = time();
        $partner_id = cloud_get_field('partner_id', 'customers_from', "openid = '{$openid}'");
        $number = 'M' . date('YmdHis') . randStr(6);
        //echo
        $field = "`number`,`partner_id`,`realname`,`sex`,`createtime`,`mobile`";
        $value = "'{$number}','{$partner_id}','{$realname}','{$sex}','{$createtime}','{$mobile}'";
        if (cloud_insert('customers', $field, $value)) {
            $res = array('flag' => 1);
        }
    }
    //http://cloud.net:8083/plus/hhr_customers.php
}
die(json_encode($res));
//生成随机�?
function randStr($len = 4)
{
    $chars = '1234567890';
Beispiel #4
0
<?php

$res = array('flag' => 0);
if (strpos($_SERVER['HTTP_USER_AGENT'], "MicroMessenger")) {
    if ($_POST) {
        require_once '../inc/common_hhr.php';
        $share_id = $_POST['share_id'];
        $type = $_POST['type'];
        $partner_id = $_POST['partner_id'];
        $time = time();
        $share_url = cloud_get_field('redirect_link', 'partner_message_tips', 'id = ' . $share_id);
        if (!empty($share_url)) {
            $have_record = cloud_get_field('id', 'partner_share_record', "partner_id = '{$partner_id}' AND share_id = '{$share_id}' AND  type = '{$type}'");
            if (!empty($have_record)) {
                if (cloud_update('partner_share_record', 'share_num = share_num+1,time = ' . $time, "id = '{$have_record}'")) {
                    $res = array('flag' => 1);
                }
            } else {
                $field = "share_id,type,partner_id,share_url,share_num,time";
                $value = "'{$share_id}','{$type}','{$partner_id}','{$share_url}','1','{$time}'";
                if (cloud_insert('partner_share_record', $field, $value)) {
                    $res = array('flag' => 1);
                }
            }
        }
    }
    //http://m.meilala.net/plus/hhr_share_record.php
    //cloud.net:8083/plus/hhr_share_record.php
    //share_id=298&partner_id=74&type=1
}
die(json_encode($res));