Commit df253444 by 王洁

Merge branch 'membercard' into test

parents 92574a5f 44ca2dde
# 2.0.28
- token里添加万人万店标识
# 2.0.27
- 公众号通知跳转url
# 2.0.26
- 添加新的支付来源常量
# 2.0.25
- 修改接口备注
# 2.0.24
- 新加获取托管小程序access_token的接口
# 2.0.23
- v3,v4整合上线
# 2.0.22
- 买家修改
# 2.0.21
- fixbug:协程方式记腾讯云日志
# 2.0.18
- 获取卖家by openid
# 2.0.17
- 配合前端v2版本上线
......
......@@ -8,7 +8,7 @@
}
],
"require": {
"qcloud/cos-sdk-v5": ">=1.0",
"qcloud/cos-sdk-v5": "^1.3",
"catfan/medoo": "^1.6"
},
"autoload": {
......
......@@ -5,6 +5,7 @@
* Date: 2018/7/5
* Time: 15:47
*/
namespace Hdll\Services\Buyer\Lib;
use Swoft\Core\ResultInterface;
......@@ -12,85 +13,87 @@ use Swoft\Core\ResultInterface;
/**
* @method ResultInterface deferGetUser(string $token)
* @method ResultInterface deferUpdateProfile(string $token, array $data)
* @method ResultInterface deferSelectUser(int $storeId, array $buyerIds, array $fields= ['*'])
* @method ResultInterface deferGetRefereeInfo($storeId,$buyerId)
* @method ResultInterface deferSelectUser(int $storeId, array $buyerIds, array $fields = ['*'])
* @method ResultInterface deferGetRefereeInfo($storeId, $buyerId)
* @method ResultInterface deferGetByNickname($nickname)
* @method ResultInterface deferCreateUser($storeId, $data = [])
* @method ResultInterface deferUpdateUser($storeId, $buyerId, $data)
* Interface BuyerInterface
* @package App\Lib
*/
interface BuyerInterface
{
/**
* 获取用户信息
*
* @param int $storeId
* @param int $buyerId
* @return mixed
array(8) {
["id"]=> int(1) //买家id
["unionId"]=>string(28) "oyDnT5OYVCQUC9X9ErkDHBNrad90"
["storeId"]=>int(0)//店铺id
["referId"]=>int(0)//推荐人ID
["state"]=>int(0)//买家状态
["nickName"]=>string(0) ""//买家昵称
["openId"]=>string(0) ""//买家openId
["profile"]=>
array(4) {
["realName"]=>string(12) "真实姓名"
["gender"]=>int(1)//性别
["phoneNumber"]=>string(11) "18812345678"//手机号
["birthday"]=>int(0) //生日
}
["commission"]=>
array(3) {
["totalCommission"]=>int(10)//总共提现
["balanceCommission"]=>int(10)//可提现金额
["expectCommission"]=>int(20)//冻结提现金额
}
}
*
*/
public function getUser(int $storeId, int $buyerId);
/**
* 获取用户信息
*
* @param int $storeId
* @param int $buyerId
* @return mixed
* array(8) {
* ["id"]=> int(1) //买家id
* ["unionId"]=>string(28) "oyDnT5OYVCQUC9X9ErkDHBNrad90"
* ["storeId"]=>int(0)//店铺id
* ["referId"]=>int(0)//推荐人ID
* ["state"]=>int(0)//买家状态
* ["nickName"]=>string(0) ""//买家昵称
* ["openId"]=>string(0) ""//买家openId
* ["profile"]=>
* array(4) {
* ["realName"]=>string(12) "真实姓名"
* ["gender"]=>int(1)//性别
* ["phoneNumber"]=>string(11) "18812345678"//手机号
* ["birthday"]=>int(0) //生日
* }
* ["commission"]=>
* array(3) {
* ["totalCommission"]=>int(10)//总共提现
* ["balanceCommission"]=>int(10)//可提现金额
* ["expectCommission"]=>int(20)//冻结提现金额
* }
* }
*
*/
public function getUser(int $storeId, int $buyerId);
/**
* 更新用户信息
* $updateInfo = [
"realName" => "真实姓名",
"gender" => "性别",
"phoneNumber" => "手机号",
"birthday" => "生日"
];
* @param int $storeId
* @param array $data
* @return mixed
*/
public function updateProfile(int $storeId, array $data);
/**
* 更新用户信息
* $updateInfo = [
* "realName" => "真实姓名",
* "gender" => "性别",
* "phoneNumber" => "手机号",
* "birthday" => "生日"
* ];
* @param int $storeId
* @param array $data
* @return mixed
*/
public function updateProfile(int $storeId, array $data);
/**
* 是否已经注册用户
* @param $storeId
* @param $unionid
* @return mixed
*
* 返回值:
* array(3) {
["id"]=> int(1)//买家id
["storeId"]=> int(1) //店铺id
["referId"]=> int(0) //推荐人id
}
*/
public function hasUser($storeId,$unionid);
/**
* 是否已经注册用户
* @param $storeId
* @param $unionid
* @return mixed
*
* 返回值:
* array(3) {
* ["id"]=> int(1)//买家id
* ["storeId"]=> int(1) //店铺id
* ["referId"]=> int(0) //推荐人id
* }
*/
public function hasUser($storeId, $unionid);
public function selectUser(int $storeId, array $buyerIds, array $fields= ['*']);
public function selectUser(int $storeId, array $buyerIds, array $fields = ['*']);
/**
* 根据买家id获取其上级信息
*
* @param $storeId
* @param $buyerId
* @return mixed
*/
public function getRefereeInfo($storeId,$buyerId);
/**
* 根据买家id获取其上级信息
*
* @param $storeId
* @param $buyerId
* @return mixed
*/
public function getRefereeInfo($storeId, $buyerId);
/**
......@@ -100,4 +103,30 @@ interface BuyerInterface
* @author work
*/
public function getByNickname($nickname);
/**
* 创建买家
* @param $storeId
* @param array $data = [
* "storeId"=>'',
* "unionId"=>'',
* "referId"=>'',
* "openId"=>'',
* "nickname"=>'',
* "headimgurl"=>'',
* 'isEntrusted'=>'',
* ]
* @return mixed
*/
public function createUser($storeId, $data = []);
/**
* 更新买家信息
* @param $storeId
* @param $buyerId
* @param $data
* @return mixed
*/
public function updateUser($storeId, $buyerId, $data);
}
\ No newline at end of file
......@@ -58,9 +58,21 @@ class LogHandler extends AbstractProcessingHandler
$messageText = implode(" __||__ ", $records);
if($this->topicId == ClsLog::TOPICID_ERROR) {
ClsLog::error($messageText);
if (App::isCoContext()) {
go(function () use ($messageText) {
ClsLog::error($messageText);
});
} else {
ClsLog::error($messageText);
}
} else if($this->topicId == ClsLog::TOPICID_NOTICE) {
ClsLog::notice($messageText);
if (App::isCoContext()) {
go(function () use ($messageText) {
ClsLog::notice($messageText);
});
} else {
ClsLog::notice($messageText);
}
}
}
......
......@@ -163,6 +163,10 @@ class User
return $this->getValue('openid');
}
public function getOrigin()
{
return $this->getValue('origin');
}
public function getUnionid()
{
......@@ -193,6 +197,19 @@ class User
return false;
}
/**
* 是否是通过“万人万店”的小程序授权
*
* @return boolean 如果是 返回true
*/
public function isWrwd()
{
$wrwd = $this->getValue('isWrwd');
if($wrwd == 1) {
return true;
}
return false;
}
public function initUser($token)
{
......
<?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\Pool\PoolProperties;
/**
* the config of service user
*
* @Bean()
*/
class LotteryPoolConfig extends PoolProperties
{
public function __construct()
{
// 区别本地和线上的RPC服务地址
// $this->uri = explode(',', env('RPC_GROUPBOOKING_URI', '172.21.0.38:8099,172.16.255.27:8099'));
$this->uri = explode(',', env('RPC_LOTTERY_URI', 'lottery:8099'));
}
protected $name = 'groupBooking';
/**
* Minimum active number of connections
*
* @var int
*/
protected $minActive = 5;
/**
* the maximum number of active connections
*
* @var int
*/
protected $maxActive = 300;
/**
* the maximum number of wait connections
*
* @var int
*/
protected $maxWait = 400;
/**
* Maximum waiting time
*
* @var int
*/
protected $maxWaitTime = 3;
/**
* Maximum idle time
*
* @var int
*/
protected $maxIdleTime = 60;
/**
* the time of connect timeout
*
* @var int
*/
protected $timeout = 200;
/**
* the addresses of connection
*
* <pre>
* [
* '127.0.0.1:88',
* '127.0.0.1:88'
* ]
* </pre>
*
* @var array
*/
protected $uri = [
'192.168.3.39:8200',
];
/**
* whether to user provider(consul/etcd/zookeeper)
*
* @var bool
*/
protected $useProvider = false;
/**
* the default balancer is random balancer
*
* @var string
*/
protected $balancer = '';
/**
* the default provider is consul provider
*
* @var string
*/
protected $provider = '';
}
<?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\Pool\PoolProperties;
use Swoft\Bean\Annotation\Value;
/**
* @Bean()
* the config of service bargain
*/
class MemberCardPoolConfig extends PoolProperties
{
public function __construct()
{
// 区别本地和线上的RPC服务地址
$this->uri = explode(',', env('RPC_MEMBERCARD_URI', 'membercard:8099'));
}
protected $name = 'membercard';
/**
* Minimum active number of connections
*
* @var int
*/
protected $minActive = 5;
/**
* the maximum number of active connections
*
* @var int
*/
protected $maxActive = 300;
/**
* the maximum number of wait connections
*
* @var int
*/
protected $maxWait = 400;
/**
* Maximum waiting time
*
* @var int
*/
protected $maxWaitTime = 3;
/**
* Maximum idle time
*
* @var int
*/
protected $maxIdleTime = 60;
/**
* the time of connect timeout
*
* @var int
*/
protected $timeout = 200;
/**
* the addresses of connection
*
* <pre>
* [
* '127.0.0.1:88',
* '127.0.0.1:88'
* ]
* </pre>
* @Value(name="", env="${RPC_BARGAIN_URI}")
* @var array
*/
protected $uri = [
'membercard:8099',
];
/**
* whether to user provider(consul/etcd/zookeeper)
*
* @var bool
*/
protected $useProvider = false;
/**
* the default balancer is random balancer
*
* @var string
*/
protected $balancer = '';
/**
* the default provider is consul provider
*
* @var string
*/
protected $provider = '';
}
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/7/26
* Time: 16:00
*/
namespace Hdll\Services\FlowCount\Enum;
/**
* 访问量和转发量 枚举
* Class BrowseShare
* @package Hdll\Services\FlowCount\Enum
*/
class BrowseShare
{
const GOODS = 0; // 普通商品
const BARGAIN = 1; // 砍价
const LIMIT = 2; // 限时购
const GROUP = 3; // 拼团
const RECHARGE = 4; // 储值卡
const TIMES_CARD = 5; // 次卡
const FRONT_MONEY = 6; // 定金
const AWARD = 7; // 抽奖
}
\ No newline at end of file
......@@ -8,10 +8,16 @@
namespace Hdll\Services\FlowCount\Enum;
/**
* 是否新访客 枚举
* Class FlowCategory
* @package Hdll\Services\FlowCount\Enum
*/
class FlowCategory
{
const BARGAIN = 1; // 砍价
const LIMIT = 2; // 限时购
const GROUP = 3; // 团购
const FRONTMONEY = 4; // 定金
const AWARD = 5; // 抽奖
}
\ No newline at end of file
......@@ -36,7 +36,7 @@ interface VisitorInterface
/**
* 访问量和转发量
* @param int $storeId 店铺id
* @param int $type 类型:0普通商品 1砍价 2限时购 3拼团
* @param int $type 类型(接口使用枚举:BrowseShare):0普通商品 1砍价 2限时购 3拼团 4储值卡 5次卡 6定金 7抽奖
* @param array $itemIds 商品或活动(活动指:砍价、限时购 、拼团)的id列表
* 说明:$itemIds 格式[1,2,3]
* @return ;
......@@ -59,7 +59,7 @@ interface VisitorInterface
/**
* 统计是否有新访客
* @param int $storeId 店铺id
* @param int $type 类型:FlowCategory::BARGAIN 砍价 FlowCategory::LIMIT 限时购 FlowCategory::GROUP 拼团
* @param int $type 类型(接口使用枚举:FlowCategory):1砍价 2限时购 3拼团 4定金 5抽奖
* @param array $itemIds 活动ids列表,格式:[1,2,3],默认:null
* @return mixed
* 响应参数:
......
<?php
namespace Hdll\Services\Lottery\Lib;
use Swoft\Core\ResultInterface;
/**
* @method ResultInterface deferAdminCountActivity($storeId)
* @method ResultInterface deferGetNewOrderNum($storeId, $time)
* Class LotteryInterface
* @package Hdll\Services\Lottery\Lib
*/
interface LotteryInterface
{
/**
* 获取所有活动数量
* [
* 'total'=>1,
* 'online'=>1
* ]
* @param $storeId
* @return mixed
* @author work
*/
public function adminCountActivity($storeId);
/**
* 获取新订单数量
* @param $storeId
* @param $time
* @return mixed
* @return number
* @author work
*/
public function getNewOrderNum($storeId, $time);
}
\ 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\MemberCard\Lib;
use Swoft\Core\ResultInterface;
/**
* The interface of demo service
*
* @method ResultInterface deferGetWxMsg(array $msgArr)
*/
interface MemberCardInterface
{
/**
*接收微信消息事件
*
*
* @param [array] $msgArr
* @return int
*/
public function getWxMsg(array $msgArr);
}
......@@ -5,6 +5,7 @@
* Date: 2018/10/9
* Time: 10:50
*/
namespace Hdll\Services\Notice\Extensions\Notice;
use Hdll\Services\Notice\Common\WxMiniNotice;
......@@ -12,51 +13,58 @@ use Hdll\Services\Notice\Enum\NoticeEnum;
class MpSender implements SenderInterface
{
private $sendType = NoticeEnum::TYPE_MP_SEND;
private $data;
private $unionId;
private $miniprogram;
private $sendData;
private $template;
public function __construct(string $unionId,array $miniprogram, array $sendData, string $template)
{
$this->unionId = $unionId;
$this->miniprogram = $miniprogram;
$this->sendData = $sendData;
$this->template = $template;
}
public function format()
{
$this->data[$this->sendType] = [
'unionId' => $this->unionId,
'template_id' => $this->template,
'miniprogram' => [
'appid' => $this->miniprogram['appId'], //小程序appid
'pagepath' => WxMiniNotice::generatePage(
$this->miniprogram['page'],
$this->miniprogram['param']
)//小程序页面
],
'data' => $this->sendData
];
}
public function getData()
{
return $this->data === null?[]:$this->data;
}
public function getSendType()
{
return [$this->sendType];
}
private $sendType = NoticeEnum::TYPE_MP_SEND;
private $data;
private $unionId;
private $miniprogram;
private $sendData;
private $template;
public function __construct(string $unionId, array $miniprogram, array $sendData, string $template)
{
$this->unionId = $unionId;
$this->miniprogram = $miniprogram;
$this->sendData = $sendData;
$this->template = $template;
}
public function format()
{
$this->data[$this->sendType] = [
'unionId' => $this->unionId,
'template_id' => $this->template,
'miniprogram' => [
'appid' => $this->miniprogram['appId'], //小程序appid
],
'data' => $this->sendData
];
//小程序跳转(优先)
if (isset($this->miniprogram['page'])) {
$this->data[$this->sendType]['pagepath'] = WxMiniNotice::generatePage(
$this->miniprogram['page'],
$this->miniprogram['param']
);
}
//url跳转
if (isset($this->miniprogram['url'])) {
$this->data[$this->sendType]['url'] = $this->miniprogram['url'];
}
}
public function getData()
{
return $this->data === null ? [] : $this->data;
}
public function getSendType()
{
return [$this->sendType];
}
}
\ No newline at end of file
......@@ -8,5 +8,6 @@ class PayOriginEnum
const SELLER_MP = 3;//卖家公众号
const CARD = 4;//储值卡支付
const TIMESCARD = 5;//次卡支付
const BUYER_MP = 6;//买家公众号
}
\ No newline at end of file
......@@ -23,6 +23,7 @@ use Swoft\Core\ResultInterface;
* @method ResultInterface deferUpdateRelationVip($sellerId, $isVip)
* @method ResultInterface deferCountVip($sellerId, $isVip)
* @method ResultInterface deferCountSeller($start, $end)
* @method ResultInterface deferGetByOpenId($openId, $fields)
*
* Interface SellerInterface
* @package App\Lib
......@@ -96,4 +97,6 @@ interface SellerInterface
public function countVip($sellerId);
public function countSeller($start, $end);
public function getByOpenId($openId, $fields);
}
\ No newline at end of file
......@@ -17,6 +17,7 @@ use Swoft\Core\ResultInterface;
*
* @method ResultInterface deferGetEntrustedData(int $storeId, array $fields = [])
* @method ResultInterface deferGetEntrustedDataByMchid(int $mchid, array $fields = [])
* @method ResultInterface deferGetEntAccessToken($storeId)
* @method ResultInterface deferGetWxpayCerts(int $storeId, $mchid)
*/
interface EntrustedInterface
......@@ -31,6 +32,19 @@ interface EntrustedInterface
public function getEntrustedData(int $storeId, array $fields = []);
/**
* 根据店铺ID获取托管小程序的 authorizer_access_token
* authorizer_access_token用来调用小程序的相关接口
*
* @param int $storeId
* @return array
* array(
* 'appid' => 'wx234skdfjsd232k',
* 'access_token' => 'askdjflkasjdfkjasdkfjklasjl',
* )
*/
public function getEntAccessToken($storeId);
/**
* 根据店铺id和商户平台id获取对应的支付证书
*
* @param int $storeId
......
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