修改数据库配置

This commit is contained in:
liaofei 2019-11-28 18:42:19 +08:00
parent 8875a1e82b
commit 08142b4c84
7 changed files with 155 additions and 165 deletions

View File

@ -125,8 +125,7 @@ if (!function_exists('make_path')) {
} }
} }
if(!function_exists('sysConfig')) if (!function_exists('sysConfig')) {
{
/** /**
* 获取系统单个配置 * 获取系统单个配置
* @param string $name * @param string $name
@ -141,8 +140,7 @@ if(!function_exists('sysConfig'))
} }
} }
if(!function_exists('sysData')) if (!function_exists('sysData')) {
{
/** /**
* 获取系统单个配置 * 获取系统单个配置
* @param string $name * @param string $name

View File

@ -1,4 +1,5 @@
<?php <?php
namespace app\models\routine; namespace app\models\routine;
use crmeb\utils\Template; use crmeb\utils\Template;
@ -71,13 +72,15 @@ class RoutineTemplate
$data['keyword5']['value'] = '已成功退款'; $data['keyword5']['value'] = '已成功退款';
return self::sendOut('ORDER_REFUND_SUCCESS', $order['uid'], $data); return self::sendOut('ORDER_REFUND_SUCCESS', $order['uid'], $data);
} }
/** /**
* 用户申请退款给管理员发送消息 * 用户申请退款给管理员发送消息
* @param array $order * @param array $order
* @param string $refundReasonWap * @param string $refundReasonWap
* @param array $adminList * @param array $adminList
*/ */
public static function sendOrderRefundStatus($order = array(),$refundReasonWap = '',$adminList = array()){ public static function sendOrderRefundStatus($order = array(), $refundReasonWap = '', $adminList = array())
{
$data['keyword1'] = $order['order_id']; $data['keyword1'] = $order['order_id'];
$data['keyword2'] = $refundReasonWap; $data['keyword2'] = $refundReasonWap;
$data['keyword3'] = date('Y-m-d H:i:s', time()); $data['keyword3'] = date('Y-m-d H:i:s', time());
@ -95,7 +98,8 @@ class RoutineTemplate
* @param int $bargainUserId * @param int $bargainUserId
* @return bool * @return bool
*/ */
public static function sendBargainSuccess($bargain = array(),$bargainUser = array(),$bargainUserId = 0){ public static function sendBargainSuccess($bargain = array(), $bargainUser = array(), $bargainUserId = 0)
{
$data['keyword1'] = $bargain['title']; $data['keyword1'] = $bargain['title'];
$data['keyword2'] = $bargainUser['bargain_price']; $data['keyword2'] = $bargainUser['bargain_price'];
$data['keyword3'] = $bargainUser['bargain_price_min']; $data['keyword3'] = $bargainUser['bargain_price_min'];
@ -114,7 +118,8 @@ class RoutineTemplate
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public static function sendOrderSuccess($formId = '',$orderId = ''){ public static function sendOrderSuccess($formId = '', $orderId = '')
{
if ($orderId == '') return; if ($orderId == '') return;
$order = StoreOrder::where('order_id', $orderId)->find(); $order = StoreOrder::where('order_id', $orderId)->find();
$data['keyword1'] = $orderId; $data['keyword1'] = $orderId;

View File

@ -57,7 +57,7 @@ return [
// Query类 // Query类
'query' => '', 'query' => '',
// 是否需要断线重连 // 是否需要断线重连
'break_reconnect' => false, 'break_reconnect' => true,
], ],
// 更多的数据库配置信息 // 更多的数据库配置信息

View File

@ -4,6 +4,7 @@
* User: xurongyao <763569752@qq.com> * User: xurongyao <763569752@qq.com>
* Date: 2019/11/13 4:52 PM * Date: 2019/11/13 4:52 PM
*/ */
namespace crmeb\repositories; namespace crmeb\repositories;
use app\models\user\WechatUser; use app\models\user\WechatUser;
@ -28,12 +29,12 @@ class NoticeRepositories
*/ */
public static function noticeOrderPaySuccess($order, $formId) public static function noticeOrderPaySuccess($order, $formId)
{ {
$wechatUser = WechatUser::where('uid',$order['uid'])->field('openid','routine_openid')->find(); $wechatUser = WechatUser::where('uid', $order['uid'])->field(['openid', 'routine_openid'])->find();
if ($wechatUser) { if ($wechatUser) {
$openid = $wechatUser['openid']; $openid = $wechatUser['openid'];
$routineOpenid = $wechatUser['routine_openid']; $routineOpenid = $wechatUser['routine_openid'];
try { try {
if($openid){//公众号发送模板消息 if ($openid && in_array($order['is_channel'],[0,2])) {//公众号发送模板消息
WechatTemplateService::sendTemplate($openid, WechatTemplateService::ORDER_PAY_SUCCESS, [ WechatTemplateService::sendTemplate($openid, WechatTemplateService::ORDER_PAY_SUCCESS, [
'first' => '亲,您购买的商品已支付成功', 'first' => '亲,您购买的商品已支付成功',
'keyword1' => $order['order_id'], 'keyword1' => $order['order_id'],
@ -50,13 +51,14 @@ class NoticeRepositories
]); ]);
//订单支付成功后给客服发送客服消息 //订单支付成功后给客服发送客服消息
CustomerRepository::sendOrderPaySuccessCustomerService($order, 1); CustomerRepository::sendOrderPaySuccessCustomerService($order, 1);
}else if($routineOpenid){//小程序发送模板消息 } else if ($routineOpenid && in_array($order['is_channel'],[1,2])) {//小程序发送模板消息
RoutineTemplate::sendOrderSuccess($formId, $order['order_id']); RoutineTemplate::sendOrderSuccess($formId, $order['order_id']);
//订单支付成功后给客服发送客服消息 //订单支付成功后给客服发送客服消息
CustomerRepository::sendOrderPaySuccessCustomerService($order, 0); CustomerRepository::sendOrderPaySuccessCustomerService($order, 0);
} }
}catch (\Exception $e){} } catch (\Exception $e) {
}
} }
//打印小票 //打印小票
$switch = sysConfig('pay_success_printing_switch') ? true : false; $switch = sysConfig('pay_success_printing_switch') ? true : false;
@ -72,7 +74,7 @@ class NoticeRepositories
$value['productInfo']['store_name'] = StoreOrderCartInfo::getSubstrUTf8($value['productInfo']['store_name'], 10, 'UTF-8', ''); $value['productInfo']['store_name'] = StoreOrderCartInfo::getSubstrUTf8($value['productInfo']['store_name'], 10, 'UTF-8', '');
$product[] = $value; $product[] = $value;
} }
YLYService::getInstance()->setContent(sysConfig('site_name'),is_object($order) ? $order->toArray() : $order,$product)->orderPrinting(); YLYService::instance()->setContent(sysConfig('site_name'), is_object($order) ? $order->toArray() : $order, $product)->orderPrinting();
} catch (\Exception $e) { } catch (\Exception $e) {
Log::error('小票打印出现错误,错误原因:' . $e->getMessage()); Log::error('小票打印出现错误,错误原因:' . $e->getMessage());
} }

View File

@ -64,7 +64,7 @@ class ChatHandle
if (!$to_uid) return $response->send('err_tip', ['msg' => '用户不存在']); if (!$to_uid) return $response->send('err_tip', ['msg' => '用户不存在']);
if ($to_uid == $uid) return $response->send('err_tip', ['msg' => '不能和自己聊天']); if ($to_uid == $uid) return $response->send('err_tip', ['msg' => '不能和自己聊天']);
if (!in_array($msn_type, [1, 2, 3, 4])) return $response->send('err_tip', ['msg' => '格式错误']); if (!in_array($msn_type, [1, 2, 3, 4])) return $response->send('err_tip', ['msg' => '格式错误']);
$msn = htmlspecialchars($msn); $msn = trim(strip_tags(str_replace(["\n", "\t", "\r", " ", "&nbsp;"], '', htmlspecialchars_decode($msn))));
$data = compact('to_uid', 'msn_type', 'msn', 'uid'); $data = compact('to_uid', 'msn_type', 'msn', 'uid');
$data['add_time'] = time(); $data['add_time'] = time();
$connections = $this->service->user(); $connections = $this->service->user();

View File

@ -34,22 +34,6 @@ trait LogicTrait
return call_user_func_array([self::$instance, $method], $params); return call_user_func_array([self::$instance, $method], $params);
} }
/**
* 执行本类的方法
* @param string $carryoutname 方法名
* @return boolean
* */
public static function CarryOut($carryoutname)
{
$methords = get_class_methods(self::class);
if(!in_array($carryoutname,$methords)) return false;
try{
return (new self)->$carryoutname();
}catch (\Exception $e){
return false;
}
}
/** /**
* 配置参数 * 配置参数
* @param array $config * @param array $config
@ -88,10 +72,8 @@ trait LogicTrait
*/ */
protected function registerProviders() protected function registerProviders()
{ {
if (property_exists($this,'providers')) if (property_exists($this, 'providers')) {
{ foreach ($this->providers as $key => $provider) {
foreach ($this->providers as $key=>$provider)
{
$this->register(new $provider(), $key); $this->register(new $provider(), $key);
} }
} }
@ -106,7 +88,7 @@ trait LogicTrait
{ {
$response = $pimple->register($this->items); $response = $pimple->register($this->items);
if (is_array($response)) { if (is_array($response)) {
list($key,$provider)=$response; [$key, $provider] = $response;
$this->$key = $provider; $this->$key = $provider;
} else if (is_string($key)) { } else if (is_string($key)) {
$this->$key = $pimple; $this->$key = $pimple;
@ -125,6 +107,7 @@ trait LogicTrait
self::$instance = new self(); self::$instance = new self();
self::$instance->setConfig($config); self::$instance->setConfig($config);
self::$instance->registerProviders(); self::$instance->registerProviders();
if (method_exists(self::$instance, 'bool'))
self::$instance->bool(); self::$instance->bool();
} }
return self::$instance; return self::$instance;
@ -162,15 +145,14 @@ trait LogicTrait
*/ */
public function __call($method, $ages) public function __call($method, $ages)
{ {
$keys = array_keys($this->providers); $keys = property_exists($this, 'providers') ? array_keys($this->providers) : [];
$propsRuleKeys = property_exists($this, 'propsRule') ? array_keys($this->propsRule) : []; $propsRuleKeys = property_exists($this, 'propsRule') ? array_keys($this->propsRule) : [];
if (strstr($method, 'set') !== false) { if (strstr($method, 'set') !== false) {
$attribute = lcfirst(str_replace('set', '', $method)); $attribute = lcfirst(str_replace('set', '', $method));
if (property_exists($this,$attribute) if (property_exists($this, $attribute) && in_array($attribute, $propsRuleKeys)) {
&& in_array($attribute,$propsRuleKeys)
&& isset($this->propsRule[$attribute]))
{
$propsRuleValeu = $this->propsRule[$attribute]; $propsRuleValeu = $this->propsRule[$attribute];
$valeu = null;
if (is_array($propsRuleValeu)) {
$type = $propsRuleValeu[1] ?? 'string'; $type = $propsRuleValeu[1] ?? 'string';
$callable = $propsRuleValeu[2] ?? null; $callable = $propsRuleValeu[2] ?? null;
if ($type == 'callable' && $callable) { if ($type == 'callable' && $callable) {
@ -181,8 +163,11 @@ trait LogicTrait
} else if ($type) { } else if ($type) {
$ages[0] = $this->toType($ages[0], $type) ?? null; $ages[0] = $this->toType($ages[0], $type) ?? null;
} }
} else {
$valeu = $propsRuleValeu;
}
$this->{$attribute} = $ages[0]; $this->{$attribute} = $ages[0] ?? $valeu;
return $this; return $this;
} }
} else if (in_array($method, $keys)) { } else if (in_array($method, $keys)) {