Commit 2755624a by liwotian

merge up

parent 93d398a7
...@@ -50,21 +50,24 @@ class ClsLog ...@@ -50,21 +50,24 @@ class ClsLog
private static function uploadToCls($topicId, $pbData) { private static function uploadToCls($topicId, $pbData) {
$authorization = ClsSignature::create(); $authorization = ClsSignature::create();
$uri = 'http://ap-beijing.cls.myqcloud.com/structuredlog?topic_id='.$topicId; $uri = 'http://ap-beijing.cls.myqcloud.com/structuredlog?topic_id='.$topicId;
$res = (new Client)->post($uri, [ for($n = 0;$n < 3;$n++){
'headers' => [ $res = (new Client)->post($uri, [
'Host' => 'ap-beijing.cls.myqcloud.com', 'headers' => [
'Authorization' => $authorization, 'Host' => 'ap-beijing.cls.myqcloud.com',
'Content-Type' => 'application/x-protobuf', 'Authorization' => $authorization,
], 'Content-Type' => 'application/x-protobuf',
'body'=>$pbData, ],
'timeout' => 20, 'body'=>$pbData,
]); 'timeout' => 30,
if($res->getResponse()->getStatusCode() != 200) { ]);
$msg = '上传腾讯云日志服务失败:'.$res->getResult(); if($res->getResponse()->getStatusCode() == 200) {
self::writeClsErrors($msg); return true;
return false; }
Coroutine::sleep(1);
} }
return true; $msg = '上传腾讯云日志服务失败:'.$res->getResult();
self::writeClsErrors($msg);
return false;
} }
/** /**
......
...@@ -54,7 +54,7 @@ class CfgCenter ...@@ -54,7 +54,7 @@ class CfgCenter
} }
$valObj = json_decode($result[0]['value']); $valObj = json_decode($result[0]['value']);
if(!is_object($valObj)) { if(!is_object($valObj)) {
return; return [$name, $result[0]['value']];
} }
$keys = ''; $keys = '';
foreach($keyArr as $key) { foreach($keyArr as $key) {
...@@ -68,7 +68,7 @@ class CfgCenter ...@@ -68,7 +68,7 @@ class CfgCenter
return [trim($rkey,':'), $valObj]; return [trim($rkey,':'), $valObj];
} }
protected static function dbConnect() public static function dbConnect()
{ {
if(\env('ENVIRONMENT', '') == '') { if(\env('ENVIRONMENT', '') == '') {
// 返回线上数据库连接 // 返回线上数据库连接
......
<?php <?php
return [ namespace Hdll\Services\Common\Config;
'qCloud' => [
'Bucket' => 'hdll-1257143824', use Swoft\Redis\Redis;
'APPID' => '1257143824', use Swoft\App;
'SecretId' => 'AKIDseHj18kua0KTSJ4g9SadbVEnEUZVjvPj',
'SecretKey' => 'IPL5g5PaaSAzd6NSO8gEmLxcN4pTzJSQ', const CACHE_PREFIX = 'CONFIG_CACHE:';
'Region' => 'ap-shanghai' $redis = App::getBean(Redis::class);
], $data = $redis->get(CACHE_PREFIX . 'all');
'alisms' => [
'accessKeyId' => 'EjBn9zQxyEkKHyAA', if (empty($data)) {
'accessKeySecret' => 'AN276rwCcqCkFUVt1GLCbAy8jnj52t', $db = CfgCenter::dbConnect();
], $arr = $db->select('config', ['name', 'value']);
'cls' => [ foreach ($arr as $key => $value) {
'appid' => '1257143824 ', $v_arr = json_decode($value['value'], true);
'secretId' => 'AKIDseHj18kua0KTSJ4g9SadbVEnEUZVjvPj', $data[$value['name']] = empty($v_arr) ? $value['value'] : $v_arr;
'secretKey' => 'IPL5g5PaaSAzd6NSO8gEmLxcN4pTzJSQ', }
], $redis->set(CACHE_PREFIX . 'all', json_encode($data));
'cmq' => [ } else {
'intranet_host' => 'http://cmq-topic-bj.api.tencentyun.com',//内网 $data = json_decode($data, true);
'internet_host' => 'https://cmq-topic-bj.api.qcloud.com',//外网 }
'secretId' => 'AKIDYRW1cG2iVIg8dAoCe86vhNuA7A5oNknk', return $data;
'secretKey' => 'z0ymS7xfLrP6Sk2EKHWaXN6d0EIxX0IQ', \ No newline at end of file
],
'cryptKey' => 'ebf032f01aa2093be3ee2ee2c137hdll',
];
\ No newline at end of file
<?php <?php
namespace Hdll\Services\Common\Lib; namespace Hdll\Services\Common\Lib;
use Hdll\Services\Common\Config\CfgCenter;
use Swoft\App; use Swoft\App;
use Swoft\Redis\Redis; use Swoft\Redis\Redis;
class Xcrypt class Xcrypt
{ {
const CRYPT = 'crypt'; const CRYPT = 'cryptKey';
public static function encrypt(string $str, $key = '') public static function encrypt(string $str, $key = '')
...@@ -41,8 +42,7 @@ class Xcrypt ...@@ -41,8 +42,7 @@ class Xcrypt
} }
private static function getKey(){ private static function getKey(){
$redis = App::getBean(Redis::class); $key = CfgCenter::get(self::CRYPT);
$key = $redis->get(self::CRYPT);
if (empty($key)){ if (empty($key)){
throw new \Exception('加密密钥获取失败!'); throw new \Exception('加密密钥获取失败!');
} }
......
...@@ -13,4 +13,5 @@ class RecordEnum ...@@ -13,4 +13,5 @@ class RecordEnum
const START_NOT_PAY = 10;//未支付 const START_NOT_PAY = 10;//未支付
const START_PAY = 20;//已支付 const START_PAY = 20;//已支付
const CLOSED = 30;//已关闭 const CLOSED = 30;//已关闭
const FINISH = 40;//已完成
} }
\ No newline at end of file
...@@ -13,6 +13,7 @@ use Swoft\Core\ResultInterface; ...@@ -13,6 +13,7 @@ use Swoft\Core\ResultInterface;
* @method ResultInterface deferSellerCreateOrder(int $sellerId,int $storeId,int $itemId,int $selectedNum,int $orderType,float $total,float $goodsPrice,string $goodsName) * @method ResultInterface deferSellerCreateOrder(int $sellerId,int $storeId,int $itemId,int $selectedNum,int $orderType,float $total,float $goodsPrice,string $goodsName)
* @method ResultInterface deferGetOrderInfoBySn(int $storeId, string $orderSn) * @method ResultInterface deferGetOrderInfoBySn(int $storeId, string $orderSn)
* @method ResultInterface deferUpdateInfoById(int $storeId,int $orderId, array $updateInfo) * @method ResultInterface deferUpdateInfoById(int $storeId,int $orderId, array $updateInfo)
* @method ResultInterface deferGetSellerOrderByStoreId(int $storeId, int $itemId)
* Interface SellerOrderInterface * Interface SellerOrderInterface
* @package Hdll\Services\Order\Lib * @package Hdll\Services\Order\Lib
*/ */
...@@ -36,4 +37,6 @@ interface SellerOrderInterface ...@@ -36,4 +37,6 @@ interface SellerOrderInterface
public function updateInfoById(int $storeId,int $orderId, array $updateInfo); public function updateInfoById(int $storeId,int $orderId, array $updateInfo);
public function getSellerOrderByStoreId(int $storeId, int $itemId);
} }
\ No newline at end of file
...@@ -18,6 +18,7 @@ use Swoft\Core\ResultInterface; ...@@ -18,6 +18,7 @@ use Swoft\Core\ResultInterface;
* *
* @method ResultInterface deferGetScheduleList(int $storeId, int $month, int $cmanId = 0) * @method ResultInterface deferGetScheduleList(int $storeId, int $month, int $cmanId = 0)
* @method ResultInterface deferGetScheduleByDateId(int $storeId, int $dateId, int $cmanId = 0) * @method ResultInterface deferGetScheduleByDateId(int $storeId, int $dateId, int $cmanId = 0)
* @method ResultInterface deferIsOffday(int $storeId, int $dateId, int $cmanId = 0)
* @method ResultInterface deferUpdateSchedule(int $storeId, int $cmanId, int $dateId, array $data) * @method ResultInterface deferUpdateSchedule(int $storeId, int $cmanId, int $dateId, array $data)
* @method ResultInterface deferAddSchedule(int $storeId, int $cmanId, int $dateId, array $data) * @method ResultInterface deferAddSchedule(int $storeId, int $cmanId, int $dateId, array $data)
*/ */
...@@ -43,6 +44,15 @@ interface ScheduleInterface ...@@ -43,6 +44,15 @@ interface ScheduleInterface
public function getScheduleByDateId(int $storeId, int $dateId, int $cmanId = 0); public function getScheduleByDateId(int $storeId, int $dateId, int $cmanId = 0);
/** /**
* 判断某天是否是休息日
*
* @param integer $storeId
* @param integer $dateId 要查询的日期id,格式要求如:20180803
* @return bool 如是休息日,返回true
*/
public function isOffday(int $storeId, int $dateId, int $cmanId = 0);
/**
* 根据dateId修改某个日程的信息 * 根据dateId修改某个日程的信息
* *
* @param integer $storeId * @param integer $storeId
......
...@@ -10,4 +10,5 @@ class SellerDistributionCmqEnum{ ...@@ -10,4 +10,5 @@ class SellerDistributionCmqEnum{
const ADD_TOTAL = 'addTotal'; const ADD_TOTAL = 'addTotal';
const REFUND_ADD_BALANCE = 'refundAddBalance'; const REFUND_ADD_BALANCE = 'refundAddBalance';
const UPDATE_BILL = 'updateBill'; const UPDATE_BILL = 'updateBill';
const SAVE_BILL = 'saveBill';
} }
\ No newline at end of file
<?php
namespace Hdll\Services\Store\Enum;
class StoreCmqEnum{
const TOPIC = 'store';
const ADD_VIP_TIME = 'addVipTime';
}
\ No newline at end of file
<?php
/**
* This file is part of Swoft.
*
* @link https://swoft.org
* @document https://doc.swoft.org
* @contact group@swoft.org
* @license https://github.com/swoft-cloud/swoft/blob/master/LICENSE
*/
namespace Hdll\Services\Store\Lib;
use Swoft\Core\ResultInterface;
/**
* The interface of store service
*
* @method ResultInterface deferGetEntrustedData(int $storeId, array $fields = [])
*/
interface EntrustedInterface
{
/**
* 根据店铺id获取对应的托管配置
*
* @param int $storeId
* @param array $fields 字段列表
* @return bool
*/
public function getEntrustedData(int $storeId, array $fields = []);
}
\ No newline at end of file
...@@ -19,7 +19,7 @@ use Swoft\Core\ResultInterface; ...@@ -19,7 +19,7 @@ use Swoft\Core\ResultInterface;
* @method ResultInterface deferIsNormal(int $storeId) * @method ResultInterface deferIsNormal(int $storeId)
* @method ResultInterface deferGetStoreByStoreId(int $storeId) * @method ResultInterface deferGetStoreByStoreId(int $storeId)
* @method ResultInterface deferGetStoreBySellerId(int $sellerId) * @method ResultInterface deferGetStoreBySellerId(int $sellerId)
* @method ResultInterface deferGetListBySellerIds(array $sellerIds) * @method ResultInterface deferGetListBySellerIds(array $sellerIds, array $fields = [])
* @method ResultInterface deferGetStoreByMobile(int $mobile, array $fields = []) * @method ResultInterface deferGetStoreByMobile(int $mobile, array $fields = [])
* @method ResultInterface deferUpdateStore(int $storeId, array $data) * @method ResultInterface deferUpdateStore(int $storeId, array $data)
* @method ResultInterface deferAddVipTime(int $storeId, int $days) * @method ResultInterface deferAddVipTime(int $storeId, int $days)
...@@ -69,7 +69,7 @@ interface StoreInterface ...@@ -69,7 +69,7 @@ interface StoreInterface
* mobile 注册手机号 * mobile 注册手机号
* edition 是否VIP 2 表示是VIP * edition 是否VIP 2 表示是VIP
*/ */
public function getListBySellerIds(array $sellerIds); public function getListBySellerIds(array $sellerIds, array $fields = []);
/** /**
* 根据注册手机号获取店铺信息 * 根据注册手机号获取店铺信息
......
...@@ -13,6 +13,7 @@ use Swoft\Core\ResultInterface; ...@@ -13,6 +13,7 @@ use Swoft\Core\ResultInterface;
/** /**
* @method ResultInterface deferOpenVip($storeId, $orderId, $money) * @method ResultInterface deferOpenVip($storeId, $orderId, $money)
* @method ResultInterface deferGetVip($vipId) * @method ResultInterface deferGetVip($vipId)
* @method ResultInterface deferTryVipCountByReferId(int $referId)
* Interface SellerInterface * Interface SellerInterface
* @package App\Lib * @package App\Lib
*/ */
...@@ -22,4 +23,6 @@ interface VipInterface ...@@ -22,4 +23,6 @@ interface VipInterface
public function openVip($storeId, $orderId); public function openVip($storeId, $orderId);
public function getVip(int $vipId); public function getVip(int $vipId);
public function tryVipCountByReferId(int $referId);
} }
\ No newline at end of file
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