edit-sylive-wxapp

This commit is contained in:
lccsw
2022-10-21 15:02:11 +08:00
parent 700a5263f7
commit 851c75b370
9 changed files with 72 additions and 27 deletions
+3 -3
View File
@@ -18,8 +18,8 @@ class Syt extends CI_Controller
parent::__construct();
$this->options = [
'token' => '',
'appid' => 'wxe66f905683582780',
'appsecret' => '9546cd4de877be13ce203f3e6140633f',
'appid' => 'wxbdec8558931efffd',
'appsecret' => '583b3cd0d8e145009eda61ece003ca14',
'encodingaeskey' => '',
'debug' => false
];
@@ -39,7 +39,7 @@ class Syt extends CI_Controller
public function subscribemsg()
{
$this->load->model('market/market_sylive_subscribemsg_model', 'mdSytSubscribemsg');
$date = date('Y-m-d H:i:s', strtotime('+2 minute'));//提前2分钟发送
$date = date('Y-m-d H:i:s', strtotime('+10 minute'));//提前10分钟发送
$where['s_time<='] = $date;
$where['status'] = 0;
$res = $this->mdSytSubscribemsg->select($where, 'id asc', 1, 200);
+29
View File
@@ -0,0 +1,29 @@
<?php
/**
* 东创紫联配置账号信息
*/
define('LICHE_APICLIENT_CERT','');
define('LICHE_APICLIENT_KEY','');
class WxPayConfig
{
const APPID = 'wxbdec8558931efffd';
const APPSECRET = '583b3cd0d8e145009eda61ece003ca14';
const MCHID = '1614399682';
const KEY = 'fce3d5d4e421ed4f2fa9ee6ebdb26ea9';
const SIGN_TYPE = 'MD5';
const NOTIFY_URL = '';
//=======【证书路径设置】=====================================
const SSLCERT_PATH = LICHE_APICLIENT_CERT;
const SSLKEY_PATH = LICHE_APICLIENT_KEY;
//=======【curl代理设置】===================================
const CURL_PROXY_HOST = "0.0.0.0";//"10.152.18.220";
const CURL_PROXY_PORT = 0;//8080;
//=======【上报信息配置】===================================
const REPORT_LEVENL = 1;
}
+2 -2
View File
@@ -7,8 +7,8 @@ define('LICHE_APICLIENT_KEY',dirname(__FILE__).'/hdy_cert/apiclient_key.pem');
class WxPayConfig
{
const APPID = 'wxe66f905683582780';
const APPSECRET = '9546cd4de877be13ce203f3e6140633f';
const APPID = 'wxbdec8558931efffd';
const APPSECRET = '583b3cd0d8e145009eda61ece003ca14';
const MCHID = '1604032585';
const KEY = 'resthismdSytActivityKpiDaresthis';
const SIGN_TYPE = 'MD5';
+5 -1
View File
@@ -11,4 +11,8 @@ if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config['liche']['appid'] = 'wxe66f905683582780';
$config['liche']['appSecret'] = '9546cd4de877be13ce203f3e6140633f';
$config['liche']['token'] = 'iuvkjhz457854';
$config['liche']['appsecret'] = 'Ay2qHzlKEpPxdMzUSy5bjJcyL5lZxotOf7JThlDKQdQ';
$config['liche']['appsecret'] = 'Ay2qHzlKEpPxdMzUSy5bjJcyL5lZxotOf7JThlDKQdQ';
//好店云-服务号
$config['hdy']['appid'] = 'wxbdec8558931efffd';
$config['hdy']['appSecret'] = '583b3cd0d8e145009eda61ece003ca14';
+7 -7
View File
@@ -55,10 +55,10 @@ class Act extends Wx {
$subscribemsg = http_host_com('home')."/h5/market/sylive/act/userinfo?skey={$skey}&type=sub";
}else{
$this->load->config('wechat');
$config = $this->config->item('liche');
$config = $this->config->item('hdy');
$sub_redirect_url = urlencode(http_host_com('home') . '/h5/market/sylive/act/subscribemsg?skey=' . $skey
. '&s_time=' . $row['timeStart']);
$subscribemsg = "https://mp.weixin.qq.com/mp/subscribemsg?action=get_confirm&appid={$config['appid']}&scene=0&template_id=sdJ4eXXA3OdMZVkJdOrzusYLGr0Jpz9I7WiZurgGLBs&redirect_url={$sub_redirect_url}&reserved=test#wechat_redirect";
$subscribemsg = "https://mp.weixin.qq.com/mp/subscribemsg?action=get_confirm&appid={$config['appid']}&scene=0&template_id=DO0B9IYYub1d0oNvy9czzGbe6_1EU8PQmnLEoDOcmXA&redirect_url={$sub_redirect_url}&reserved=test#wechat_redirect";
}
}
//浏览
@@ -85,14 +85,14 @@ class Act extends Wx {
$info['statisticsurl'] = '/h5/market/sylive/stic?skey='.$info['skey'];
}
$info['channelImg'] = build_qiniu_image_url($row['channelImg']);
// $info['live_url'] = 'https://live.liche.cn/watch/'.$row['channelId'];
// $info['live_url'] = 'https://live.haodian.cn/watch/'.$row['channelId'];
$userid = $user['unionid'] ? $user['unionid'] : $this->uid;
$ts = time()*1000;
$sign = md5($this->secretkey.$userid.$this->secretkey.$ts);
if(!$user['nickname'] && !$user['headimg']){
$info['live_url'] = http_host_com('home').'/h5/market/sylive/act/userinfo?skey='.$skey;
}else{
$info['live_url'] = "https://live.liche.cn/watch/{$row['channelId']}?userid={$userid}&ts={$ts}&sign={$sign}";
$info['live_url'] = "https://live.haodian.cn/watch/{$row['channelId']}?userid={$userid}&ts={$ts}&sign={$sign}";
}
//判断是否支付商品
$is_pay = $this->market_sylive_order_model->count(['item_id'=>$a_id,'status'=>1,'uid'=>$this->uid]);
@@ -322,7 +322,7 @@ class Act extends Wx {
}
$user = $this->user_model->get(['userId'=>$this->uid]);
$notify_url = http_host_com('home').'/h5/market/sylive/notify';
$result = $this->unorder($unpay['sid'],$unpay['total_price'],$user['openid'],$unpay['item_title'],$notify_url,$unpay['expire_time']);
$result = $this->unorder($unpay['sid'],$unpay['total_price'],$user['openid'],$unpay['item_title'],$notify_url,$unpay['expire_time'],['wx_type'=>'dc']);
if(!$result['code']){
$this->show_json('',400,$result['msg']);
}
@@ -430,7 +430,7 @@ class Act extends Wx {
}
if($type=='sub'){ //订阅跳转
$this->load->config('wechat');
$config = $this->config->item('liche');
$config = $this->config->item('hdy');
$sub_redirect_url = urlencode(http_host_com('home') . '/h5/market/sylive/act/subscribemsg?skey=' . $skey
. '&s_time=' . $row['timeStart']);
$subscribemsg = "https://mp.weixin.qq.com/mp/subscribemsg?action=get_confirm&appid={$config['appid']}&scene=0&template_id=sdJ4eXXA3OdMZVkJdOrzusYLGr0Jpz9I7WiZurgGLBs&redirect_url={$sub_redirect_url}&reserved=test#wechat_redirect";
@@ -440,7 +440,7 @@ class Act extends Wx {
$userid = $user['unionid'] ? $user['unionid'] : $this->uid;
$ts = time()*1000;
$sign = md5($this->secretkey.$userid.$this->secretkey.$ts);
$live_url = "https://live.liche.cn/watch/{$row['channelId']}?userid={$userid}&ts={$ts}&sign={$sign}";
$live_url = "https://live.haodian.cn/watch/{$row['channelId']}?userid={$userid}&ts={$ts}&sign={$sign}";
redirect($live_url);
}
}
+14 -8
View File
@@ -63,7 +63,7 @@ abstract class Common extends CI_Controller{
protected function set_auth($url='',$auth=0){
$this->load->helper('url');
$this->load->config('wechat');
$config = $this->config->item('liche');
$config = $this->config->item('hdy');
$code = $this->input->get('code');
!$url && $url = http_host_com('home').$_SERVER['REQUEST_URI'];
$auth && $url = $_SERVER['QUERY_STRING'] ? $url."&auth={$auth}" : $url."?auth={$auth}";
@@ -117,26 +117,32 @@ abstract class Common extends CI_Controller{
}
/**
* 支付
* 微信下单
* @param $trade_no
* @param $price
* @param $openid
* @param $body
* @param $notify_url 异步通知
* @param $expire_time 过期时间
* @param $notify_url
* @param $expire_time
* @param $attach
* @return bool|json数据,可直接填入js函数作为参数|mixed
* @param $wx_type
* @param $other_data
* @return array|false
* @throws WxPayException
*/
protected function unorder($trade_no,$price,$openid,$body,$notify_url,$expire_time,$attach=''){
protected function unorder($trade_no,$price,$openid,$body,$notify_url,$expire_time,$other_data=[]){
if(!$body){return false;}
require_once APPPATH."../api/third_party/WXconfig/hdy_WxPay.Config.php";
require_once APPPATH."../api/third_party/WXpay/WxPay.Api.php";
if($other_data['wx_type']=='dc'){
require_once APPPATH."../api/third_party/WXconfig/dcz_WxPay.Config.php";
}else{
require_once APPPATH."../api/third_party/WXconfig/hdy_WxPay.Config.php";
}
$config = new WxPayConfig();
$wxpay = new WxPayUnifiedOrder();
$wxpay->SetVersion('1.0');
$wxpay->SetBody($body); //简单描述
$attach && $wxpay->SetAttach($attach); //附加信息
$other_data['attach'] && $wxpay->SetAttach($other_data['attach']); //附加信息
$wxpay->SetNotify_url($notify_url);
$wxpay->SetOut_trade_no($trade_no); //订单号
$wxpay->SetTotal_fee($price * 100); //支付价格
+3 -5
View File
@@ -78,11 +78,9 @@ class Login extends CI_Controller{
$this->load->helper('string');
$code = random_string('numeric', 4);
$redis->save($key, $code, 60*5);
}else{
$code = $redis->get($key);
$content = "【好店云】您的验证码为: {$code},请勿泄露于他人!";
b2m_send_sms($mobile,$content);
}
echo $code;
// send_sms($mobile, $code);
$this->show_json('',200, '验证码已发送');
}
@@ -119,7 +117,7 @@ class Login extends CI_Controller{
protected function set_auth($url='',$auth=0){
$this->load->helper('url');
$this->load->config('wechat');
$config = $this->config->item('liche');
$config = $this->config->item('hdy');
$code = $this->input->get('code');
!$url && $url = http_host_com('home').$_SERVER['REQUEST_URI'];
$auth && $url = $_SERVER['QUERY_STRING'] ? $url."&auth={$auth}" : $url."?auth={$auth}";
+8 -1
View File
@@ -1,7 +1,7 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH."../api/third_party/WXpay/WxPay.Api.php";
require_once APPPATH."../api/third_party/WXconfig/hdy_WxPay.Config.php";
class Notify extends CI_Controller {
@@ -16,10 +16,17 @@ class Notify extends CI_Controller {
$this->load->model('market/market_sylive_activity_model');
$this->load->model('market/market_sylive_activity_orders_model','mdSytActivityOrders');
$this->load->library('market/sylive_entity');
$method = $this->router->fetch_method();
if($method=='biz'){ //好店云
require_once APPPATH."../api/third_party/WXconfig/hdy_WxPay.Config.php";
}else{ //默认东创紫联
require_once APPPATH."../api/third_party/WXconfig/dcz_WxPay.Config.php";
}
try{
//如果返回成功则验证签名
$config = new WxPayConfig();
$input = file_get_contents("php://input");
debug_log("[input] ". __FUNCTION__ . "# $input:" . json_encode($input,JSON_UNESCAPED_UNICODE), $this->log_file,$this->log_dir);
$result = WxPayNotifyResults::Init($config, $input);
$this->notify = $result->GetValues();
debug_log("[info] ". __FUNCTION__ . "# notify:" . json_encode($this->notify,JSON_UNESCAPED_UNICODE), $this->log_file,$this->log_dir);
+1
View File
@@ -0,0 +1 @@
2aipsVecS0wZZCED