Exemple #1
0
function send_not_enough_message($user_data, $open_data)
{
    $data = array('first' => array('value' => $open_data['first_msg'], 'color' => "#000000"), 'keyword1' => array('value' => '尾号' . substr($user_data['cardno'], strlen($user_data['cardno']) - 4, 4), 'color' => "#173177"), 'keyword2' => array('value' => $user_data['lasttime'], 'color' => "#173177"), 'keyword3' => array('value' => $user_data['lastmoney'] . '元', 'color' => "#173177"), 'remark' => array('value' => $open_data['ex_msg']));
    $ch = new OrderPush();
    $result = $ch->doSend($user_data['openid'], $open_data['default_template'], $open_data['url'], $data);
    if ($result['errcode'] == 0) {
        return 0;
    } elseif ($result['errcode'] == '42001') {
        //如果是超期,就再刷新一下token,再发一次
        $ch->resetToken();
        $result = $ch->doSend($user_data['openid'], $open_data['default_template'], $open_data['url'], $data);
        if ($result['errcode'] == 0) {
            return 0;
        } else {
            return $result['errcode'];
        }
    }
}
Exemple #2
0
<?php

ini_set("display_errors", "On");
//打开debug
include "OrderPush.class.php";
/**************增量更新,不可用于初始化,尽量每天跑一次,如果粉丝多,每天跑10次************/
$start = mktime();
$ch = new OrderPush();
//$ch->getUserList();
$num = $ch->updateUserList();
$stop = mktime();
echo '耗时:' . ($stop - $start) . '秒,共更新了' . $num["timesup"] . '个信息,现在更新到id:' . $num["count"] . '<br><a href="">点击继续更新!</a>';