Commit b6adf9dd authored by wwccw0591's avatar wwccw0591

更新

parent 50764f49
......@@ -715,7 +715,7 @@ class OrderConfirmUtil {
$msg_tpl = $settingDAO->getListCache(array('wxapp_order_create_tpl'))['wxapp_order_create_tpl'];
$goods_str = '';
if(count($goods_datas)>1) {
$goods_str .= $goods_datas[0].'等' .count($goods_datas).'商品';
$goods_str .= $goods_datas[0].'等' .count($goods_datas).'商品';
} else {
$goods_str .= $goods_datas[0];
}
......
......@@ -147,7 +147,8 @@ class OrderServiceModel extends \Business\AbstractModel
$settingDAO = \DAO\SettingModel::getInstance();
$access_token = $this->getLitAccesstoken();
$where = array('msg_status'=>1, 'payment_type'=>1, 'order_state'=>array('gt',10), 'prepay_id'=> array('neq',
$where = array('msg_status'=>array('elt', 1), 'payment_type'=>1, 'order_state'=>array('gt',10), 'prepay_id'=>
array('neq',
''));
$wxapp_templates = $settingDAO->getListCache(array('wxapp_order_paysucc_tpl', 'wxapp_order_shipping_tpl', 'wxapp_order_receive_tpl'));
if($list = $model->getList($where, 'order_id,order_sn,store_name,buyer_id,order_amount,payment_time, order_state, prepay_id', 0, 10, array('payment_time','asc'))) {
......@@ -165,15 +166,22 @@ class OrderServiceModel extends \Business\AbstractModel
$req_data = array('touser'=>$member['member_wxopenid'], 'template_id'=> $msg_tpl,
'form_id'=> $order['prepay_id'],
'data'=>array(
array('keyword1'=>array('value'=>$order['order_sn'])),
array('keyword2'=>array('value'=>$order['store_name'])),
array('keyword3'=>array('value'=>$goods_str)),
array('keyword4'=>array('value'=>number_format($order['order_amount']/100, 2)).'元'),
array('keyword5'=>array('value'=>date('Y-m-d H:i',$order['payment_time']))),
array('keyword6'=>array('value'=>'已付款')),
'keyword1'=>array('value'=>$order['order_sn']),
'keyword2'=>array('value'=>$order['store_name']),
'keyword3'=>array('value'=>$goods_str),
'keyword4'=>array('value'=>number_format($order['order_amount']/100, 2).'元'),
'keyword5'=>array('value'=>date('Y-m-d H:i',$order['payment_time'])),
'keyword6'=>array('value'=>'已付款'),
));
$url = 'https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=';
$result = $this->sendurl($url, $access_token, $req_data, 'post');
if($result = $this->sendurl($url, $access_token, $req_data, 'post')) {
$json = json_decode($result, true);
if($json['errmsg']=='ok') {
$model->updateByOrderId($order, $order['order_id']);
echo 'order[' . $order['order_id'] .'] send payment succ'."\n";
}
}
}
}
}
......
......@@ -44,6 +44,7 @@ class cliOrderSendTemplateMessage extends basecli
private function autoSendMessage(){
$service = \Business\Order\OrderServiceModel::getInstance(\Our\DbNameConst::masterDBConnectName);
$service->baseDir = \Our\Common::getConfig('out.config');
$service->sendTemplateMessage();
}
protected function _runCli()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment