Commit 1296182d by 王召彬

Merge branch 'master' of http://139.199.22.180/tencent/services

parents 77522385 0699ffb1
<?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\AccountBook\Lib;
use Swoft\Core\ResultInterface;
/**
* The interface of demo service
*
* @method ResultInterface deferIncome(int $storeId, int $money,int $orderId)
* @method ResultInterface deferExpense(int $storeId, int $money,int $orderId)
*/
interface AccountInterface
{
/**
* 流水增加
* @param $storeId
* @param $money
* @param $ordirId
* @return bool
*/
public function Income($storeId, $money, $ordirId);
/**
* 流水减少
* @param $storeId
* @param $money
* @param $ordirId
* @return bool
*/
public function Expense($storeId, $money, $ordirId);
}
\ No newline at end of file
......@@ -20,13 +20,13 @@ class {className}
public function create(array $info) : {entityName}
{
${entityName} = new {entityName}($info);
$res = ${entityName}->save()->getResult();
${varEntityName} = new {entityName}($info);
$res = ${varEntityName}->save()->getResult();
if ( $res === false ) {
throw new CommonException(["msg" => "数据库操作错误", "code" => 500]);
}
return ${entityName};
return ${varEntityName};
}
public function selectInfoByCondition($condition, $field)
......
......@@ -23,6 +23,6 @@ class {dataName}
* @Inject()
* @var {daoName}
*/
private ${daoName};
private ${varDaoName};
}
\ No newline at end of file
......@@ -30,7 +30,7 @@ class GenerateCommand
*
* @Options
* -n,--n the dao name
* -e, --e the entity name
* -e,--e the entity name
*
* @Example
* php swoft generate:dao -e entityName [-n daoName]
......@@ -56,7 +56,7 @@ class GenerateCommand
*
* @Options
* -n,--n the dao name
* -e, --e the entity name
* -e,--e the entity name
*
* @Example
* php swoft generate:dao -e entityName [-n dataName] [--dao-name daoName]
......@@ -85,6 +85,7 @@ class GenerateCommand
$content = file_get_contents($templatePath);
$content = str_replace('{dataName}', $dataName, $content);
$content = str_replace("{daoName}", $daoName, $content);
$content = str_replace("{varDaoName}", lcfirst($daoName), $content);
file_put_contents($dataPath, $content);
......@@ -111,6 +112,7 @@ class GenerateCommand
$content = str_replace("{className}", $daoName,$content);
$content = str_replace("{entityName}", $entityName, $content);
$content = str_replace("{varEntityName}", lcfirst($entityName), $content);
file_put_contents($daoPath,$content);
......
<?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 AccountBookPoolConfig extends PoolProperties
{
public function __construct()
{
// 区别本地和线上的RPC服务地址
$this->uri = explode(',', env('RPC_ACCOUNTBOOK_URI', 'accountbook:8099'));
}
protected $name = 'accountbook';
/**
* Minimum active number of connections
*
* @var int
*/
protected $minActive = 5;
/**
* the maximum number of active connections
*
* @var int
*/
protected $maxActive = 50;
/**
* the maximum number of wait connections
*
* @var int
*/
protected $maxWait = 100;
/**
* 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 = [
'timelimtbuy: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 = '';
}
......@@ -15,6 +15,7 @@ use Swoft\Core\ResultInterface;
* @method ResultInterface deferIncSales($storeId, $goodsId)
* @method ResultInterface deferDecSales($storeId, $goodsId)
* @method ResultInterface deferGetServiceByGoodsId($storeId, $goodsId)
* @method ResultInterface deferGetReturnVisitByGoodsId($storeId, $goodsId)
* Interface GoodsInterface
* @package Hdll\Services\Goods\Lib
*/
......@@ -72,4 +73,14 @@ interface GoodsInterface
* @author Administrator
*/
public function getServiceByGoodsId($storeId,$goodsId);
/**
* 获取用户回访
* @param $storeId
* @param $goodsId
* @return mixed
* @author Administrator
*/
public function getReturnVisitByGoodsId($storeId, $goodsId);
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/9/6
* Time: 10:23
*/
namespace Hdll\Services\Notice\Extensions\Notice;
use Hdll\Services\Notice\Common\WxMiniNotice;
use Hdll\Services\Notice\Enum\NoticeEnum;
class MiniBackendSender implements SenderInterface
{
private $sendType = NoticeEnum::TYPE_MINI_BACKEND_SEND;
private $data;
private $user;
private $page;
private $sendData;
private $template;
public function __construct(array $user,array $page, array $sendData, string $template)
{
$this->user = $user;
$this->page = $page;
$this->sendData = $sendData;
$this->template = $template;
}
/**
* 格式化数据
*/
public function format()
{
//$sendType
$this->data[$this->sendType] = [
"uid" => $this->user['id'], //用户的id
"template_id" => $this->template,//消息模板id
"page" => WxMiniNotice::generatePage(
$this->page['page'],
$this->page['param']
), //消息模板页面
];
foreach ( $this->sendData as $key => $data ) {
$key +=1;
$this->data[$this->sendType]['data']["keyword{$key}"]['value'] = $data;
}
}
/**
* 获取发送数据
*
* @return mixed
*/
public function getData ()
{
return $this->data;
}
/**
* 获取发送类型
*
* @return array
*/
public function getSendType()
{
return [$this->sendType];
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/9/6
* Time: 10:23
*/
namespace Hdll\Services\Notice\Extensions\Notice;
use Hdll\Services\Notice\Common\WxMiniNotice;
use Hdll\Services\Notice\Enum\NoticeEnum;
/**
* Class MiniFrontendSender
* @package Hdll\Services\Notice\Extensions\Notice
*/
class MiniFrontendSender implements SenderInterface
{
private $sendType = NoticeEnum::TYPE_MINI_FRONTEND_SEND;
private $data;
private $user;
private $page;
private $sendData;
private $template;
/**
*
* $send = new MiniFrontendSender( ['id' => 1, 'storeId' => 198],
* [
* 'page' => 'pages/orderShow/orderShow',
* 'param' => ['orderId' => 1, 'storeId' => 168]
* ],
* [
* 1 => 'aaaaaaa',
* 2 => 'msg',
* 3 => '您好,您申请的退款不符合条件被拒绝',
* ],
* 'jcqYc-gHjkv-T8pDW8wjYFha0TKzCJTV3yNeGY3JW-0'
* );
* MiniFrontendSender constructor.
*
* @param array $user
* @param array $page
* @param array $sendData
* @param string $template
*/
public function __construct(array $user,array $page, array $sendData, string $template)
{
$this->user = $user;
$this->page = $page;
$this->sendData = $sendData;
$this->template = $template;
}
/**
* 格式化数据
*/
public function format()
{
//$sendType
$this->data[$this->sendType] = [
"uid" => $this->user['id'], //用户的id
"storeId" => $this->user['storeId'], //店铺的id
"template_id" => $this->template,//消息模板id
"page" => WxMiniNotice::generatePage(
$this->page['page'],
$this->page['param']
), //消息模板页面
];
foreach ( $this->sendData as $key => $data ) {
$key +=1;
$this->data[$this->sendType]['data']["keyword{$key}"]['value'] = $data;
}
}
/**
* 获取发送数据
*
* @return mixed
*/
public function getData ()
{
return $this->data;
}
/**
* 获取发送类型
*
* @return array
*/
public function getSendType()
{
return [$this->sendType];
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/10/9
* Time: 10:50
*/
namespace Hdll\Services\Notice\Extensions\Notice;
use Hdll\Services\Notice\Common\WxMiniNotice;
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;
}
public function getSendType()
{
return [$this->sendType];
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/9/6
* Time: 10:21
*/
namespace Hdll\Services\Notice\Extensions\Notice;
interface SenderInterface
{
public function format();
public function getData ();
public function getSendType();
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/9/10
* Time: 14:53
*/
namespace Hdll\Services\Notice\Extensions\Notice;
use Hdll\Services\Notice\Enum\NoticeEnum;
class TencentSMS implements SenderInterface
{
private $sendType = NoticeEnum::TYPE_TENCENT_SMS;
private $data;
private $phone;
private $template;
private $param;
public function __construct(string $phone, string $template, array $param)
{
$this->phone = $phone;
$this->template = $template;
$this->param = $param;
}
public function format()
{
$this->data[$this->sendType] = [
[
'templateId' => $this->template,
'phoneNumber' => $this->phone,
'param' => $this->param,
]
];
}
public function getData()
{
$this->data;
}
public function getSendType()
{
return [$this->sendType];
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/10/9
* Time: 9:22
*/
namespace Hdll\Services\Notice\Extensions;
use Hdll\Services\Notice\Extensions\Notice\SenderInterface;
use Hdll\Services\Notice\Lib\NoticeInterface;
class NoticeExtension
{
private $notice;
public function __construct(NoticeInterface $notice)
{
$this->notice = $notice;
}
/**
* 发送消息通知
*
* @param int $sendTime
* @param mixed ...$senders
* @return bool|mixed
*/
public function send(int $sendTime, ... $senders)
{
$data = [];
$sendType = [];
foreach ( $senders as $sender ) {
if ( ! $sender instanceof SenderInterface) {
continue;
}
if ( in_array($sender->getSendType(), $sendType) ) {
continue;
}
$sender->format();
$data += $sender->getData();
$sendType += $sender->getSendType();
}
return $this->notice->send($sendType, $data, $sendTime);
}
}
\ No newline at end of file
......@@ -61,7 +61,7 @@ interface NoticeInterface
*
* 微信公众号发送实例
$data[NoticeEnum::TYPE_MP_SEND] = [
'touser' => 'o3lFcs8xoWfQUlhzTiP5uZI6A7Hc', //这里要填写公众号的openId
'unionId' => 'o3lFcs8xoWfQUlhzTiP5uZI6A7Hc', //填写用户的unionId
'template_id' => 'zwUBuoKVRJkumLwGkippA46XfmLsmwJD906HC-wqOks',
'miniprogram' => [
'appid' => 'wx3b3b2df942634cdd', //小程序appid
......
......@@ -23,6 +23,7 @@ use Swoft\Core\ResultInterface;
* @method ResultInterface deferUpdateInfoByIds(int $storeId,array $orderIds, array $updateInfo)
* @method ResultInterface deferCollectionClose(int $storeId, int $orderId)
* @method ResultInterface deferGetOtherInfo(int $storeId, string $orderSn, array $consigneeFields = [], array $itemFields = [])
* @method ResultInterface deferGetList(int $storeId,array $ids)
*/
interface OrderInterface
{
......@@ -150,4 +151,82 @@ interface OrderInterface
*/
public function getOtherInfo(int $storeId, string $orderSn, array $consigneeFields = [], array $itemFields = []);
/**
* 批量获取订单信息
* [5]=>
* array(28) {
["id"]=>
string(1) "1"
["orderSn"]=>
string(20) "198bSA93091872375217"
["paySn"]=>
string(28) "4200000198201809300361147593"
["orderType"]=>
string(1) "0"
["storeId"]=>
string(3) "198"
["buyerId"]=>
string(1) "1"
["itemId"]=>
string(1) "1"
["consigneeId"]=>
string(1) "1"
["goodsAmount"]=>
string(1) "1"
["orderAmount"]=>
string(1) "1"
["actualAmount"]=>
string(1) "1"
["refundAmount"]=>
string(1) "1"
["state"]=>
string(2) "60"
["refundState"]=>
string(1) "2"
["refundMsg"]=>
string(30) "身体不适,暂时不做了"
["lockState"]=>
string(1) "0"
["lockMsg"]=>
string(0) ""
["balanceState"]=>
string(1) "0"
["balanceTime"]=>
string(1) "0"
["message"]=>
string(0) ""
["reservationTime"]=>
string(1) "0"
["createTime"]=>
string(10) "1538291872"
["updateTime"]=>
string(10) "1538291953"
["deleteTime"]=>
string(1) "0"
["sellerId"]=>
string(1) "6"
["deliveredTime"]=>
string(1) "0"
["commission"]=>
string(1) "0"
["items"]=>
array(1) {
[0]=>
array(2) {
["name"]=>
string(7) "商品1"
["image"]=>
string(72) "store-198/goods/tmp_7d07ba3c8e10c3cd65de8d98d00cbd5aace9e736ddde0c59.jpg"
}
}
}
}
*
* @param int $storeId
* @param array $ids
* @return mixed
*/
public function getList(int $storeId,array $ids);
}
\ No newline at end of file
......@@ -18,8 +18,9 @@ use Swoft\Core\ResultInterface;
*
* @method ResultInterface deferGetReservById(int $storeId, int $id)
* @method ResultInterface deferIsReserved(int $storeId, int $cmanId, int $reservTime)
* @method ResultInterface deferGetReservListByOrderId(int $storeId, int $orderId, int $state = 0)
* @method ResultInterface deferGetReservListByOrderId(int $storeId, int $orderId, $state = null)
* @method ResultInterface deferModifyReservById(int $storeId, int $id, array $data)
* @method ResultInterface defermarkReservFinished(int $storeId, int $orderId)
* @method ResultInterface deferAddReservation(int $storeId, int $orderId, int $buyerId, int $cmanId, int $reservTime, string $memo, int $type)
* @method ResultInterface deferCancelReservById(int $storeId, int $id)
* @method ResultInterface deferCancelReservByOrderId(int $storeId, int $orderId)
......@@ -55,7 +56,7 @@ interface ReservationInterface
* @param integer $state
* @return array
*/
public function getReservListByOrderId(int $storeId, int $orderId, int $state = 0);
public function getReservListByOrderId(int $storeId, int $orderId, $state = null);
/**
* 修改某个预约信息
......@@ -72,6 +73,16 @@ interface ReservationInterface
public function modifyReservById(int $storeId, int $id, array $data);
/**
* 根据orderId标记订单下所有预约的状态为“已完成”
*
* @param integer $storeId
* @param integer $orderId
* @Number(name="orderId")
* @return bool 返回操作结果,true操作成功
*/
public function markReservFinished(int $storeId, int $orderId);
/**
* 添加预约
*
* @param integer $storeId
......
......@@ -14,6 +14,7 @@ use Swoft\Core\ResultInterface;
* @method ResultInterface deferSave($referId, $unionId, $openId, $nickName, $headImgUrl)
* @method ResultInterface deferGet($id,$fields=['*'])
* @method ResultInterface deferGetByUnionId($unionId,$fields=['*'])
* @method ResultInterface deferGetByStoreId($storeId,$fields=['*'])
* @method ResultInterface deferUpdate($id,$data)
* Interface SellerInterface
* @package App\Lib
......@@ -65,4 +66,12 @@ interface SellerInterface
*/
public function update($condition,$data);
/**
* @param $storeId
* @param array $fields
* @return mixed
* @author Administrator
*/
public function getByStoreId($storeId, $fields = ['*']);
}
\ 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