Commit 2755624a by liwotian

merge up

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