Commit c68aec28 by dzhang

Merge branch 'test' of http://git.dev.2b3.cn/tencent/services into test

parents f398bd6e 5acfbb22
# 2.0.44
- VIP保赚服务上线
# 2.0.43
- 优惠券上线
# 2.0.42 # 2.0.42
- 活动方案+实物订单上线 - 活动方案+实物订单上线
......
...@@ -12,6 +12,7 @@ use Swoft\Core\ResultInterface; ...@@ -12,6 +12,7 @@ use Swoft\Core\ResultInterface;
/** /**
* @method ResultInterface deferGetInfo(int $id) * @method ResultInterface deferGetInfo(int $id)
* @method ResultInterface deferGetBatch(array $ids)
* Interface VisitorInterface * Interface VisitorInterface
* @package App\Lib * @package App\Lib
*/ */
...@@ -24,4 +25,16 @@ interface ActivityPlanInterface ...@@ -24,4 +25,16 @@ interface ActivityPlanInterface
*/ */
public function getInfo(int $id); public function getInfo(int $id);
/**
* 根据ids批量获取活动方案信息
* @param array $ids
* @return mixed
* 返回示例:
* [
* "id" => ["id" => 1, "title" => "方案名称"], // 键值对返回,下标是方案id
* ... ...
* ]
*/
public function getBatch(array $ids);
} }
\ No newline at end of file
...@@ -18,8 +18,9 @@ use Swoft\Core\ResultInterface; ...@@ -18,8 +18,9 @@ use Swoft\Core\ResultInterface;
* *
* @method ResultInterface deferGetgoodsInfo(int $storeId, int $bargain_id) * @method ResultInterface deferGetgoodsInfo(int $storeId, int $bargain_id)
* @method ResultInterface deferGetBargainInfo(int $storeId, int $goodsId) * @method ResultInterface deferGetBargainInfo(int $storeId, int $goodsId)
* @method ResultInterface deferPayStatus(string $storeId,int $bargainbranchId,int $status, int $orderId) * @method ResultInterface deferPayStatus(string $storeId,int $bargainbranchId,int $status, int $orderId)
* @method ResultInterface deferGetBargainCounts(int $storeId) * @method ResultInterface deferGetBargainCounts(int $storeId)
* @method ResultInterface deferGetNotEndedActivityList($storeId)
* @method ResultInterface deferGetNewOrderNum(int $storeId,int $lastTime) * @method ResultInterface deferGetNewOrderNum(int $storeId,int $lastTime)
*/ */
interface BargainInterface interface BargainInterface
...@@ -64,6 +65,13 @@ interface BargainInterface ...@@ -64,6 +65,13 @@ interface BargainInterface
*/ */
public function getBargainCounts(int $storeId); public function getBargainCounts(int $storeId);
/**
* 获取店铺尚未结束的活动列表
*
* @return mixed
*/
public function getNotEndedActivityList($storeId);
/** /**
*获取自上次时间以来产生的新订单数 *获取自上次时间以来产生的新订单数
* *
......
<?php <?php
namespace Hdll\Services\Buyer\Lib; namespace Hdll\Services\Buyer\Lib;
interface FansInterface interface FansInterface
{ {
public function get(string $unionId); public function get(string $unionId);
public function getByUnionIds(array $unionIds, array $fields = ['*']);
} }
\ No newline at end of file
<?php <?php
namespace Hdll\Services\Common\Config; namespace Hdll\Services\Common\Config;
use Swoft\Redis\Redis; use Swoft\Redis\Redis;
use Swoft\App; use Swoft\App;
class CfgCenter class CfgCenter
{ {
const COS = 'cos'; //腾讯云存储
const CLS = 'cls'; //腾讯云日志服务
const CMQ = 'cmq'; //腾讯云cmq订阅消息
const ENCRYPT_KEY = 'encrypt_key'; //数据加密的key
const BACKEND_WEAPP = 'backend_weapp'; //蓝猫小程序配置
const FRONTEND_WEAPP = 'frontend_weapp'; //橙猫小程序配置
const ALIYUN_SMS = 'aliyun_sms'; //阿里云短信
const TENCENT_SMS = 'tencent_sms'; //腾讯云短信
const MP = 'mp'; //公众号-用于H5公众号登录和发送公众号通知
const MP_CARD = 'mp_card'; //制作卡券公众号
const PAY = 'pay'; //支付配置
const DRAW_MONEY = 'draw_money'; //提现配置
const PAY_KUANYUAN = 'pay_kuanyuan'; //宽元的支付平台配置
const PAY_YUNMAI_ISP = 'pay_yunmai_isp'; //云脉的支付服务商配置,用于托管子商户
const PAY_ZHIMEI = 'pay_zhimei'; //致美的支付配置
const SELLER_DISTRIBUTION = 'seller_distribution'; //卖家分销配置
const MP_ZHIMEI = 'mp_zhimei'; //致美的公众号配置
/**
* 根据用户token获取配置, 优先使用此方法读取配置
* 用法:
* $cfgdata = CfgCenter::getByUser(CfgCenter::COS, $this->user);
* var_dump($cfgdata['Region']); // 输出:ap-shanghai
* @param string $keyName
* @param \Hdll\Services\Common\Entity\User $user 用户token的实例对象
* @return mixed
*/
public static function getByUser($keyName, \Hdll\Services\Common\Entity\User $user)
{
if( is_numeric($user->getOemId()) ) { // oemId有可能等于0
return self::getByOemId($keyName, $user->getOemId());
} else if($user->getStoreId()) {
return self::getByStoreId($keyName, $user->getStoreId());
} else if($user->getUnionid()) {
return self::getByUnionId($keyName, $user->getUnionid());
}
}
/**
* 根据oemId读取指定的配置项 - 返回数组格式
* @param string $keyName
* @param int $oemId oemId==0表示是活动啦啦
* @return mixed
*/
public static function getByOemId($keyName, int $oemId)
{
return self::_get($keyName, $oemId);
}
/**
* 如果有oemId,尽量使用方法getByOemId()读取配置
* 根据storeId获取所属OEM平台的配置
*
* @param string $keyName
* @param string $storeId
* @return mixed
*/
public static function getByStoreId($keyName, int $storeId)
{
$dbConn = self::dbConnect('seller');
$result = $dbConn->get("seller", ['oemId'], ['storeId' => $storeId]);
return self::_get($keyName, (int)$result['oemId']);
}
/**
* 如果有oemId,尽量使用方法getByOemId()读取配置
* 根据sellerId获取所属OEM平台的配置
*
* @param string $keyName
* @param string $sellerId
* @return mixed
*/
public static function getBySellerId($keyName, int $sellerId)
{
$dbConn = self::dbConnect('seller');
$result = $dbConn->get("seller", ['oemId'], ['sellerId' => $sellerId]);
return self::_get($keyName, (int)$result['oemId']);
}
/**
* 如果有oemId,尽量使用方法getByOemId()读取配置
* 根据unionId获取所属OEM平台的配置
*
* @param string $keyName
* @param string $unionId
* @return mixed
*/
public static function getByUnionId($keyName, string $unionId)
{
$dbConn = self::dbConnect('seller');
$result = $dbConn->get("seller", ['oemId'], ['unionId' => $unionId]);
return self::_get($keyName, (int)$result['oemId']);
}
/**
* 如果有oemId,尽量使用方法getCertByOemId()读取证书
* 根据店铺id获取支付证书
*
* @param integer $storeId
* @return array
*/
public static function getCertByStoreId($keyName, $storeId) {
$dbConn = self::dbConnect('seller');
$result = $dbConn->get("seller", ['oemId'], ['storeId' => $storeId]);
$oemId = (int)$result['oemId'];
$dbConn = self::dbConnect();//连接配置库
// 注意,需要返回oemId字段
$result = $dbConn->get("config", ['oemId', 'certPem', 'keyPem'], ['oemId' => $oemId, 'name' => $keyName]);
return $result;
}
/**
* 根据oemId获取支付证书
*
* @param integer $oemId
* @return array
*/
public static function getCertByOemId($keyName, int $oemId) {
$dbConn = self::dbConnect();//连接配置库
// 注意,需要返回oemId字段
$result = $dbConn->get("config", ['oemId', 'certPem', 'keyPem'], ['oemId' => $oemId, 'name' => $keyName]);
return $result;
}
/**
* 根据mchId获取对应的支付配置
*
* @param string $mchId
* @return mixed
*/
public static function getByMchId(int $mchId)
{
$dbConn = self::dbConnect();//连接配置库
$result = $dbConn->get("config", ['value'], ['mchId' => $mchId]);
$resArr = json_decode($result['value'], true);
return is_array($resArr) ? $resArr : $result['value'];
}
public static function dbConnect($database='')
{
if($database == '') {
$database = 'config_center';
}
if (\env('ENVIRONMENT', '') == '') {
// 返回线上数据库连接
return new \Medoo\Medoo([
'database_type' => 'mysql',
'database_name' => $database,
'server' => '172.21.0.12',
'username' => 'configer',
'password' => 'Cfgsu#2390f*_',
'charset' => 'utf8'
]);
} else {
// 返回测试数据库连接
return new \Medoo\Medoo([
'database_type' => 'mysql',
'database_name' => $database,
'server' => '192.168.3.202',
'username' => 'hdller',
'password' => 'Hdlltest888',
'charset' => 'utf8'
]);
}
}
private static function _get($keyName, int $oemId = 1)
{
$prefix = "CONFIG_CENTER:oemid_$oemId:";
$redis = App::getBean(Redis::class);
$data = $redis->get($prefix . $keyName);
if($data) {
$result = json_decode($data, true);
return is_array($result) ? $result : $data;
}
// 没有缓存则从数据库读取:
$valArr = self::_getConfigFromDb($keyName, $oemId);
if ($valArr) { //有内容时进行redis缓存
if (is_array($valArr)) {
$valArr['oemId'] = $oemId; //需要将oemId加入配置返回
$redis->set($prefix . $keyName, json_encode($valArr), 3600);
} else {
$redis->set($prefix . $keyName, $valArr, 3600);
}
}
return $valArr;
}
private static function _getConfigFromDb($keyName, $oemId)
{
$dbConn = self::dbConnect();
$result = $dbConn->select("config", ['value'], ['oemId' => $oemId, 'name' => $keyName]);
if (!isset($result[0]['value'])) {
if($oemId > 0) {
// 如果指定的oemId查找不到,则使用活动啦啦(oemId==0)的配置
$result = $dbConn->select("config", ['value'], ['oemId' => 0, 'name' => $keyName]);
if (!isset($result[0]['value'])) {
return;
}
} else {
return;
}
}
$valArr = json_decode($result[0]['value'], true);
if (!is_array($valArr)) {
return $result[0]['value'];
}
return $valArr;
}
/**
* 读取指定的配置项 - 返回对象格式
* (所有配置项,需预先添加到数据库中)
* 方法一:
* $value = CfgCenter::get('qCloud>Weapp>Region');
* var_dump($value); // 输出:ap-shanghai
* 方法二:
* $cfgdata = CfgCenter::get('qCloud');
* var_dump($cfgdata->Weapp->Region); // 输出:ap-shanghai
*
* @param string $keyStr
* @param string $default 默认返回值
* @return mixed
*/
public static function get($keyStr, $default='')
{
$data = self::_get($keyStr);
if($data == '') {
return $default;
}
return $data;
}
/**
* 读取指定的配置项 - 返回数组格式
* (所有配置项,需预先添加到数据库中)
* 方法一:
* $value = CfgCenter::get('qCloud>Weapp>Region');
* var_dump($value); // 输出:ap-shanghai
* 方法二:
* $cfgdata = CfgCenter::get('qCloud');
* var_dump($cfgdata['Weapp']['Region']); // 输出:ap-shanghai
*
* @param string $keyStr
* @param string $default 默认返回值
* @return mixed
*/
public static function getArray($keyStr, $default='')
{
$data = self::_get($keyStr);
if($data == '') {
return $default;
}
if(is_object($data)) {
return json_decode(json_encode($data), true);
}
return $data;
}
private static function _get($keyStr)
{
$keyArr = self::parseKeyStr($keyStr);
$rkey = implode(":", $keyArr);
$redis = App::getBean(Redis::class);
$data = $redis->get("CONFIG_CENTER:".$rkey);
if($data === null) {
$res = self::dbFetch($keyStr);
if($res) {
if(is_object($res[1])) {
$val = json_encode($res[1]);
} else {
$val = $res[1];
}
$redis->set("CONFIG_CENTER:".$res[0], $val, 3600);
return $res[1];
}
}
$obj = json_decode($data);
if($obj && is_object($obj)) {
return $obj;
}
return $data;
}
protected static function dbFetch($keyStr)
{
$keyArr = self::parseKeyStr($keyStr);
$name = array_shift($keyArr);
$dbConn = self::dbConnect();
$result = $dbConn->select("config", ['name','value'], ['name'=>$name]);
if(!isset($result[0]['value'])) {
return;
}
$valObj = json_decode($result[0]['value']);
if(!is_object($valObj)) {
return [$name, $result[0]['value']];
}
$keys = '';
foreach($keyArr as $key) {
if(!isset($valObj->$key)) {
return;
}
$keys .= $key.':';
$valObj = $valObj->$key;
}
$rkey = $name.':'.trim($keys,':');
return [trim($rkey,':'), $valObj];
}
public static function dbConnect()
{
if(\env('ENVIRONMENT', '') == '') {
// 返回线上数据库连接
return new \Medoo\Medoo([
'database_type' => 'mysql',
'database_name' => 'config_center',
'server' => '172.21.0.12',
'username' => 'configer',
'password' => 'Cfgsu#2390f*_',
'charset' => 'utf8'
]);
} elseif(\env('ENVIRONMENT', '') == 'pre') {
// 返回测试数据库连接
return new \Medoo\Medoo([
'database_type' => 'mysql',
'database_name' => 'config_center',
'server' => '192.168.3.201',
'username' => 'hdller',
'password' => 'Hdlltest999',
'charset' => 'utf8'
]);
} else {
// 返回测试数据库连接
return new \Medoo\Medoo([
'database_type' => 'mysql',
'database_name' => 'config_center',
'server' => '192.168.3.202',
'username' => 'hdller',
'password' => 'Hdlltest888',
'charset' => 'utf8'
]);
}
}
protected static function parseKeyStr($keyStr)
{
$keyArr = explode(">", trim($keyStr, '>'));
foreach($keyArr as $k => $v) {
$v = trim($v);
if($v == "") {
unset($keyArr[$k]);
} else {
$keyArr[$k] = $v;
}
}
if(empty($keyArr)) {
throw new \Exception("[CfgCenter]未指定合法的Key");
}
return $keyArr;
}
} }
...@@ -37,6 +37,11 @@ class User ...@@ -37,6 +37,11 @@ class User
return $this->getValue('id'); return $this->getValue('id');
} }
public function getOemId()
{
return $this->getValue('oemId');
}
public function setTestFlag() public function setTestFlag()
{ {
$this->setValue('testFlag', TestEnum::TEST_STORE_ID); $this->setValue('testFlag', TestEnum::TEST_STORE_ID);
......
...@@ -8,9 +8,6 @@ use Swoft\Redis\Redis; ...@@ -8,9 +8,6 @@ use Swoft\Redis\Redis;
class Xcrypt class Xcrypt
{ {
const CRYPT = 'cryptKey';
public static function encrypt(string $str, $key = '') public static function encrypt(string $str, $key = '')
{ {
$str = serialize($str); $str = serialize($str);
...@@ -42,10 +39,10 @@ class Xcrypt ...@@ -42,10 +39,10 @@ class Xcrypt
} }
private static function getKey(){ private static function getKey(){
$key = CfgCenter::get(self::CRYPT); $key = CfgCenter::getByOemId(CfgCenter::ENCRYPT_KEY, 0);
if (empty($key)){ if (empty($key)){
throw new \Exception('加密密钥获取失败!'); throw new \Exception('加密密钥获取失败!');
} }
return $key; return $key;
} }
} }
\ No newline at end of file \ 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\Common\Pool\Config;
use Swoft\Bean\Annotation\Bean;
use Swoft\Bean\Annotation\Value;
use Swoft\Pool\PoolProperties;
/**
*
* @Bean()
*/
class InsurancePoolConfig extends PoolProperties
{
public function __construct()
{
// 区别本地和线上的RPC服务地址
$this->uri = explode(',', env('RPC_INSURANCE_URI', 'insurance:8099'));
}
/**
* the name of pool
*
*/
protected $name = 'insurance';
/**
* Minimum active number of connections
*
*/
protected $minActive = 5;
/**
* the maximum number of active connections
*
*/
protected $maxActive = 300;
/**
* the maximum number of wait connections
*
*/
protected $maxWait = 400;
/**
* Maximum waiting time
*
*/
protected $maxWaitTime = 3;
/**
* Maximum idle time
*
*/
protected $maxIdleTime = 60;
/**
* the time of connect timeout
*
*/
protected $timeout = 200;
/**
* the addresses of connection
*
* <pre>
* [
* '127.0.0.1:88',
* '127.0.0.1:88'
* ]
* </pre>
*
*/
protected $uri = [
"192.168.3.100:8102",
];
/**
* whether to user provider(consul/etcd/zookeeper)
*
*/
protected $useProvider = false;
/**
* the default balancer is random balancer
*
*/
protected $balancer = '';
/**
* the default provider is consul provider
*
*/
protected $provider = '';
}
...@@ -14,6 +14,7 @@ use Swoft\Core\ResultInterface; ...@@ -14,6 +14,7 @@ use Swoft\Core\ResultInterface;
* @method ResultInterface deferAdd(int $storeId, array $data) * @method ResultInterface deferAdd(int $storeId, array $data)
* @method ResultInterface deferBrowseAndShare(int $storeId, int $type, array $itemIds) * @method ResultInterface deferBrowseAndShare(int $storeId, int $type, array $itemIds)
* @method ResultInterface deferNewVisitor(int $storeId, int $type, array $itemIds = null) * @method ResultInterface deferNewVisitor(int $storeId, int $type, array $itemIds = null)
* @method ResultInterface deferVisitorCount(array $storeIds, int $beginDate, int $endDate)
* Interface VisitorInterface * Interface VisitorInterface
* @package App\Lib * @package App\Lib
*/ */
...@@ -74,4 +75,14 @@ interface VisitorInterface ...@@ -74,4 +75,14 @@ interface VisitorInterface
*/ */
public function newVisitor(int $storeId, int $type, array $itemIds = null); public function newVisitor(int $storeId, int $type, array $itemIds = null);
/**
* 根据日期访问统计访客数
* @param array $storeIds 店铺id列表
* @param int $beginDate 开始日期,格式:20191212
* @param int $endDate 开始日期,格式:20191212
* @return mixed
* 响应参数:数字
*/
public function visitorCount(array $storeIds, int $beginDate, int $endDate);
} }
\ No newline at end of file
...@@ -21,6 +21,7 @@ use Swoft\Core\ResultInterface; ...@@ -21,6 +21,7 @@ use Swoft\Core\ResultInterface;
* @method ResultInterface deferGetFrontInfo(int $storeId, int $goodsId) * @method ResultInterface deferGetFrontInfo(int $storeId, int $goodsId)
* @method ResultInterface deferPayStatus(string $storeId,int $frontId, int $status, int $orderId) * @method ResultInterface deferPayStatus(string $storeId,int $frontId, int $status, int $orderId)
* @method ResultInterface deferGetFrontCounts(int $storeId) * @method ResultInterface deferGetFrontCounts(int $storeId)
* @method ResultInterface deferGetNotEndedActivityList($storeId)
* @method ResultInterface deferGetNewOrderNum(int $storeId,int $lastTime) * @method ResultInterface deferGetNewOrderNum(int $storeId,int $lastTime)
*/ */
interface FrontMoneyInterface interface FrontMoneyInterface
...@@ -80,6 +81,13 @@ interface FrontMoneyInterface ...@@ -80,6 +81,13 @@ interface FrontMoneyInterface
*/ */
public function getFrontCounts(int $storeId); public function getFrontCounts(int $storeId);
/**
* 获取店铺尚未结束的活动列表
*
* @return mixed
*/
public function getNotEndedActivityList($storeId);
/** /**
*获取自上次时间以来产生的新订单数 *获取自上次时间以来产生的新订单数
......
<?php
namespace Hdll\Services\Insurance\Enum;
class InsuranceCmqEnum
{
const TOPIC = 'insurance';
const ACTIVITY_CREATE = 'activityCreate'; // 使用活动方案创建活动时通知
}
\ 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\Insurance\Lib;
use Swoft\Core\ResultInterface;
/**
* The interface of insurance service
*
* @method ResultInterface deferGetOrderInfo(int $storeId, int $orderId)
* @method ResultInterface deferGetOrderBySn(int $storeId, $orderSn)
* @method ResultInterface deferPaySuccess(int $storeId, $orderSn)
*/
interface InsuranceInterface
{
/**
* 获取指定订单数据
*
* @param integer $storeId
* @param integer $orderId
* @return array
*/
public function getOrderInfo(int $storeId, int $orderId);
/**
* 获取指定订单数据
*
* @param integer $storeId
* @param string $orderSn
* @return array
*/
public function getOrderBySn(int $storeId, $orderSn);
/**
* 支付成功回调
*
* @param integer $storeId
* @param string $orderSn
* @return void
*/
public function paySuccess(int $storeId, $orderSn);
}
\ No newline at end of file
<?php
namespace Hdll\Services\MemberCard\Enum;
class UpBonusEvent {
const CONSUME_ADD = 1; //消费产生积分(确认收货)
const CONSUME_PAY = 2; //下单减积分
const CLOSE_ORDER = 3; //关闭订单返还积分
}
\ No newline at end of file
...@@ -23,7 +23,10 @@ use Swoft\Core\ResultInterface; ...@@ -23,7 +23,10 @@ use Swoft\Core\ResultInterface;
* @method ResultInterface deferIfUserGetCard(int $storeId,int $userId,int $escrow) * @method ResultInterface deferIfUserGetCard(int $storeId,int $userId,int $escrow)
* @method ResultInterface deferGetUserCouponDetail(int $storeId ,int $couponId) * @method ResultInterface deferGetUserCouponDetail(int $storeId ,int $couponId)
* @method ResultInterface deferSetUserCouponStatus(int $storeId,int $couponId,int $status) * @method ResultInterface deferSetUserCouponStatus(int $storeId,int $couponId,int $status)
* @method ResultInterface deferGetUserValidCouponNum(int $storeId,int $escrow,int $userId) * @method ResultInterface deferGetUserValidCouponNum(int $storeId,int $escrow,int $userId)
* @method ResultInterface deferIfCouponSuitOrder(int $storeId,int $userId,int $couponId,array $goods)
* @method ResultInterface deferUpMembercardBonus(int $storeId,int $escrow,int $userId,int $orderId,int $type,int $money=0,int $bonus=0)
* @method ResultInterface deferUpMembercardBalance(int $storeId,int $escrow,int $userId,int $balance)
*/ */
/** /**
* The interface of demo service * The interface of demo service
...@@ -107,4 +110,40 @@ interface MemberCardInterface ...@@ -107,4 +110,40 @@ interface MemberCardInterface
* @return int * @return int
*/ */
public function getUserValidCouponNum(int $storeId,int $escrow,int $userId); public function getUserValidCouponNum(int $storeId,int $escrow,int $userId);
}
\ No newline at end of file /**
* 判断优惠券是否适用于订单(下单的时候调用)
*
* @param integer $storeId
* @param integer $userId
* @param integer $couponId
* @param array $goods [{goodsId:totalPrice},...]
* @return bool
*/
public function ifCouponSuitOrder(int $storeId,int $userId,int $couponId,array $goods);
/**
* 改变用户积分
*
* @param integer $storeId
* @param integer $escrow
* @param integer $userId
* @param integer $orderId
* @param integer $type //类型 1 消费产生积分 2 积分抵扣 3订单关闭 (这里只要传1-3)【4 - 消费后订单关闭,原来增加积分的记录状态为4(1->4)】
* @param integer $money //类型1 只要传money,bonus不传; 类型2 money,bonus 都传; 类型3 积分,金额都不传
* @param integer $bonus
* @return bool
*/
public function upMembercardBonus(int $storeId,int $escrow,int $userId,int $orderId,int $type,int $money=0,int $bonus=0);
/**
* 用户储值卡余额 通知会员卡(显示在卡包 余额)
*
* @param integer $storeId
* @param integer $escrow
* @param integer $userId
* @param integer $balance
* @return bool
*/
public function upMembercardBalance(int $storeId,int $escrow,int $userId,int $balance);
}
...@@ -34,5 +34,14 @@ class NoticeEnum ...@@ -34,5 +34,14 @@ class NoticeEnum
self::TYPE_SYSTEM_SEND, self::TYPE_SYSTEM_SEND,
]; ];
const PAGE_TYPE_BACKEND = 1;//后台 蓝猫
const PAGE_TYPE_FRONT = 2;//前台 橙猫
const PAGE_TYPE_MP = 3;//公众号
const TEMPLATE_GROUP_BOOKING_SUCCESS = "GROUP_BOOKING_SUCCESS";//拼团结果通知
const TEMPLATE_BARGAIN_OVERDUE = "BARGAIN_OVERDUE"; //砍价活动过期通知
const TEMPLATE_BARGAIN_COMPLETE = "BARGAIN_COMPLETE";//砍到底价通知
const TEMPLATE_TIMESCARD_PADDLE = "TIMESCARD_PADDLE";//次卡划卡通知
const TEMPLATE_RECHARGE_PADDLE = "RECHARGE_PADDLE";//储值卡划卡通知
} }
\ No newline at end of file
...@@ -17,27 +17,40 @@ use Swoft\Core\ResultInterface; ...@@ -17,27 +17,40 @@ use Swoft\Core\ResultInterface;
* *
* @method ResultInterface deferSend(int $storeId, array $sendTypes, array $data, $sendTime, string $redisKey) :bool * @method ResultInterface deferSend(int $storeId, array $sendTypes, array $data, $sendTime, string $redisKey) :bool
* @method ResultInterface deferCancelSend(string $redisKey):bool * @method ResultInterface deferCancelSend(string $redisKey):bool
* @method ResultInterface deferCostumerSend(string $openId); * @method ResultInterface deferCostumerSend(string $openId, int $oemId = 0);
*/ */
interface NoticeInterface interface NoticeInterface
{ {
/** /**
* 参数说明 * 参数说明
* *
* thing.DATA 事物 20个以内字符 可汉字、数字、字母或符号组合
number.DATA 数字 32位以内数字 只能数字,可带小数
letter.DATA 字母 32位以内字母 只能字母
symbol.DATA 符号 5位以内符号 只能符号
character_string.DATA 字符串 32位以内数字、字母或符号 可数字、字母或符号组合
time.DATA 时间 24小时制时间格式(支持+年月日) 例如:15:01,或:2019年10月1日 15:01
date.DATA 日期 年月日格式(支持+24小时制时间) 例如:2019年10月1日,或:2019年10月1日 15:01
amount.DATA 金额 1个币种符号+10位以内纯数字,可带小数,结尾可带“元” 可带小数
phone_number.DATA 电话 17位以内,数字、符号 电话号码,例:+86-0766-66888866
car_number.DATA 车牌 8位以内,第一位与最后一位可为汉字,其余为字母或数字 车牌号码:粤A8Z888挂
name.DATA 姓名 10个以内纯汉字或20个以内纯字母或符号 中文名10个汉字内;纯英文名20个字母内;中文和字母混合按中文名算,10个字内
phrase.DATA 汉字 5个以内汉字 5个以内纯汉字,例如:配送中
*
* 微信发送消息数据结构 * 微信发送消息数据结构
* $data[NoticeEnum::TYPE_MINI_BACKEND_SEND] = [ * $data[NoticeEnum::TYPE_MINI_BACKEND_SEND] = [
"uid" => 1, //用户的id "uid" => 1, //用户的id
* "storeId" => 1, //店铺id * "storeId" => 1, //店铺id
"template_id" => "1kZ_RkkWfRrpufXNdmJYBpIhgk7ccCtPrypeJQ9WRwM",//消息模板id "tplName" => ''//订阅模版枚举
"page" => "index", //消息模板页面 "params" => [a=>'b'], //跳转页面参数
"data" => [ //消息模板数据 "data" => [ //消息模板数据
"keyword1" => [ "number01" => [
"value" => "商品名称", "value" => "商品名称",
], ],
"keyword2" => [ "date01" => [
"value" => "A8204427546131350100", "value" => "A8204427546131350100",
], ],
"keyword3" => [ "site01" => [
"value" => "¥30", "value" => "¥30",
], ],
"keyword4" => [ "keyword4" => [
...@@ -64,11 +77,8 @@ interface NoticeInterface ...@@ -64,11 +77,8 @@ interface NoticeInterface
* 微信公众号发送实例 * 微信公众号发送实例
$data[NoticeEnum::TYPE_MP_SEND] = [ $data[NoticeEnum::TYPE_MP_SEND] = [
'unionId' => 'o3lFcs8xoWfQUlhzTiP5uZI6A7Hc', //填写用户的unionId 'unionId' => 'o3lFcs8xoWfQUlhzTiP5uZI6A7Hc', //填写用户的unionId
'template_id' => 'zwUBuoKVRJkumLwGkippA46XfmLsmwJD906HC-wqOks', 'tplName' => 模版KEY,
'miniprogram' => [ 'params' => [],//小程序或url地址参数(不用传地址)array
'appid' => 'wx3b3b2df942634cdd', //小程序appid
'pagepath' => 'pages/start/start'//小程序页面
],
'data' => [ 'data' => [
'first' => 'first', 'first' => 'first',
'keyword1' => '姓名', 'keyword1' => '姓名',
...@@ -101,13 +111,14 @@ interface NoticeInterface ...@@ -101,13 +111,14 @@ interface NoticeInterface
public function send(array $sendTypes, array $data, $sendTime, string $redisKey='') :bool; public function send(array $sendTypes, array $data, $sendTime, string $redisKey='') :bool;
/** /**
* 公众号客服消息 * 公众号客服消息
* *
* @param string $openId * @param string $openId
* @return void * @param int $oemId
*/ * @return void
public function costumerSend(string $openId); */
public function costumerSend(string $openId, int $oemId = 0);
/** /**
......
...@@ -20,6 +20,7 @@ use Swoft\Core\ResultInterface; ...@@ -20,6 +20,7 @@ use Swoft\Core\ResultInterface;
* @method ResultInterface deferReturnCardMoney(int $storeId,int $buyerId,int $itemOrderId,string $itemTitle,int $payMoney, int $parentOrderId) * @method ResultInterface deferReturnCardMoney(int $storeId,int $buyerId,int $itemOrderId,string $itemTitle,int $payMoney, int $parentOrderId)
* @method ResultInterface deferStatisNum(int $storeId) * @method ResultInterface deferStatisNum(int $storeId)
* @method ResultInterface deferGetRecharge(int $storeId, int $buyerId) * @method ResultInterface deferGetRecharge(int $storeId, int $buyerId)
* @method ResultInterface deferDeductMoney($storeId, $buyerId, $name, $phone, $money, $message)
*/ */
interface RechargeInterface interface RechargeInterface
{ {
...@@ -88,6 +89,18 @@ interface RechargeInterface ...@@ -88,6 +89,18 @@ interface RechargeInterface
* @return mixed * @return mixed
*/ */
public function getRecharge(int $storeId, int $buyerId); public function getRecharge(int $storeId, int $buyerId);
/**
* 线下扣款(划卡)
* @param int $storeId
* @param int $buyerId
* @param $name
* @param $phone
* @param $money
* @param $message
* @return mixed
*/
public function deductMoney($storeId, $buyerId, $name, $phone, $money, $message);
} }
......
<?php
namespace Hdll\Services\Seller\Lib;
interface OemInterface
{
public function oemConfigByStoreId($storeId);
public function oemConfigBySeller($sellerId);
}
\ No newline at end of file
...@@ -32,16 +32,18 @@ interface SellerInterface ...@@ -32,16 +32,18 @@ interface SellerInterface
{ {
/** /**
* @param $referId * @param $referId
* @param $unionId * @param $unionId
* @param $openId * @param $openId
* @param $nickName * @param $nickName
* @param $headImgUrl * @param $headImgUrl
* @param int $gender * @param int $gender
* @param string $mpOpenId
* @param int $oemId
* @return mixed * @return mixed
* @author work * @author work
*/ */
public function save($referId, $unionId, $openId, $nickName, $headImgUrl, $gender = 2); public function save($referId, $unionId, $openId, $nickName, $headImgUrl, $gender = 2, $mpOpenId = '', $oemId = 0);
/** /**
* @param $id * @param $id
......
...@@ -22,6 +22,7 @@ use Swoft\Core\ResultInterface; ...@@ -22,6 +22,7 @@ use Swoft\Core\ResultInterface;
* @method ResultInterface defergetTimesCardUserCardInfo(int $storeId, int $goodsId) * @method ResultInterface defergetTimesCardUserCardInfo(int $storeId, int $goodsId)
* @method ResultInterface deferStatisNum(int $storeId) * @method ResultInterface deferStatisNum(int $storeId)
* @method ResultInterface deferValidNum(int $storeId, int $buyerId) * @method ResultInterface deferValidNum(int $storeId, int $buyerId)
* @method ResultInterface deferDeductCard($storeId, $buyerId, $items)
*/ */
interface TimesCardInterface interface TimesCardInterface
{ {
...@@ -86,6 +87,17 @@ interface TimesCardInterface ...@@ -86,6 +87,17 @@ interface TimesCardInterface
* @return mixed * @return mixed
*/ */
public function validNum(int $storeId, int $buyerId); public function validNum(int $storeId, int $buyerId);
/**
* 线下扣卡次数(划卡)
* @param $storeId
* @param $buyerId
* @param $name
* @param $phone
* @param $items
* @return mixed
*/
public function deductCard($storeId, $buyerId, $name, $phone, $items);
} }
......
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