Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenchuanwen
my-yaf-project
Commits
97b83af7
Commit
97b83af7
authored
Jan 23, 2019
by
zhz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
店铺考核和店铺邀请
parent
53b0077a
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
172 additions
and
15 deletions
+172
-15
Goods.php
application/controllers/Goods.php
+1
-1
Member.php
application/controllers/Member.php
+16
-0
ApiConst.php
application/library/Our/ApiConst.php
+1
-0
StoreService.php
application/models/Business/Store/StoreService.php
+22
-4
MemberService.php
application/models/Business/User/MemberService.php
+43
-1
SalespersonService.php
application/models/Business/User/SalespersonService.php
+0
-3
ShortMessageService.php
application/models/Business/User/ShortMessageService.php
+4
-0
Member.php
application/models/DAO/Member.php
+4
-2
QmStoreClass.php
application/models/DAO/QmStoreClass.php
+2
-3
Store.php
application/models/DAO/Store.php
+2
-1
QmStoreInvite.php
application/models/DAO/Store/QmStoreInvite.php
+61
-0
StoreDrainageAmount.php
application/models/DAO/Store/StoreDrainageAmount.php
+9
-0
CodeConfig.php
application/models/Error/CodeConfig.php
+7
-0
No files found.
application/controllers/Goods.php
View file @
97b83af7
...
...
@@ -43,7 +43,7 @@ class GoodsController extends \Our\Controller_AbstractIndex {
public
function
testAction
(){
//$info = $this->goodsService->recommend();
//\Business\Goods\GoodsCommonServiceModel::getInstance()->saleGoods();
\Business\Store\StoreServiceModel
::
getInstance
()
->
drainageAmountStatistics
();
\Business\Store\StoreServiceModel
::
getInstance
()
->
tryStoreExamine
();
}
public
function
getAttrsAction
(){
...
...
application/controllers/Member.php
View file @
97b83af7
...
...
@@ -146,4 +146,20 @@ class MemberController extends \Our\Controller_AbstractApi {
$this
->
success
(
new
stdClass
(),
\Our\DescribeConst
::
bindMobileForWxSuccess
,
\Our\DescribeConst
::
bindMobileForWxSuccess
);
}
/**
* 开店申请添加邀请人
*/
public
function
addInviterAction
()
{
$data
=
$this
->
req
[
\Our\NameConst
::
data
];
$this
->
memberService
->
addInviter
(
$data
,
$this
->
memberId
);
$this
->
success
(
new
stdClass
());
}
/**
* 该微信是否添加过邀请人
*/
public
function
hasAddInviterAction
()
{
$result
=
$this
->
memberService
->
addInviter
(
$this
->
memberId
);
$this
->
success
(
$result
);
}
}
application/library/Our/ApiConst.php
View file @
97b83af7
...
...
@@ -292,6 +292,7 @@ class ApiConst
const
messageTypeValidNewMobile
=
5
;
//验证新手机短信
const
messageTypeFindPassword
=
6
;
//找回密码发送验证码
const
messageTypeWxLietBindMobile
=
7
;
//微信小程序绑定手机号码验证手机号码
const
messageTypeOpenStoreInvite
=
8
;
//开店邀请人
const
userFromWeibo
=
1
;
const
userFromQQ
=
2
;
...
...
application/models/Business/Store/StoreService.php
View file @
97b83af7
...
...
@@ -1335,7 +1335,8 @@ class StoreServiceModel extends \Business\AbstractModel{
$storeClassPayLogDao
=
\DAO\Store\StoreClassPayLogModel
::
getInstance
();
$pageBegin
=
\Our\PageConst
::
taskPageBegin
;
while
(
true
)
{
$stores
=
$storeDrainageAmountDao
->
getStoreAndDrainageAmount
(
array
(
'han_store.store_end_time'
=>
array
(
'between'
,
TIMESTAMP
-
\Our\ApiConst
::
oneDaySecond
,
TIMESTAMP
),
'han_store_drainage_amount.gmt_examine'
=>
0
),
'han_store_drainage_amount.*'
,
array
(
$pageBegin
,
1000
));
$stores
=
$storeDrainageAmountDao
->
getStoreAndDrainageAmount
(
array
(
'han_store.store_end_time'
=>
array
(
'between'
,
TIMESTAMP
-
\Our\ApiConst
::
oneDaySecond
,
TIMESTAMP
),
'han_store_drainage_amount.gmt_examine'
=>
0
),
'han_store.store_citycode,han_store.member_id,han_store_drainage_amount.*'
,
array
(
$pageBegin
,
1000
));
// $stores = $storeDrainageAmountDao->getStoreAndDrainageAmount(array('han_store.store_end_time'=>array('between',0,1648209008),'han_store_drainage_amount.gmt_examine'=>0),'han_store.store_citycode,han_store.member_id,han_store_drainage_amount.*',array($pageBegin,1000));
if
(
empty
(
$stores
))
{
break
;
}
...
...
@@ -1349,9 +1350,10 @@ class StoreServiceModel extends \Business\AbstractModel{
$log
=
$storeClassPayLogDao
->
getStoreClassPayLog
(
array
(
'store_id'
=>
$store
[
'store_id'
],
'pay_state'
=>
1
));
if
(
empty
(
$log
))
{
//店铺下架,下架理由为 试用期考核不合格 并且 发送短信
$this
->
storeClose
(
$store
[
'store_id'
]
,
\Our\NameConst
::
tryStoreExamineFail
);
$this
->
storeClose
(
$store
,
\Our\NameConst
::
tryStoreExamineFail
);
}
}
$storeDrainageAmountDao
->
editDrainage
(
array
(
'store_id'
=>
$store
[
'store_id'
]),
array
(
'gmt_examine'
=>
TIMESTAMP
));
}
$pageBegin
=
(
$pageBegin
+
1
)
*
1000
;
}
...
...
@@ -1362,8 +1364,24 @@ class StoreServiceModel extends \Business\AbstractModel{
* @param $storeId
* @param $reason 下架原因
*/
public
function
storeClose
(
$storeId
,
$reason
)
{
public
function
storeClose
(
$storeInfo
,
$reason
)
{
$storeDAO
=
\DAO\StoreModel
::
getInstance
();
$memberDAO
=
\DAO\MemberModel
::
getInstance
();
$qmStoreClassDAO
=
\DAO\QmStoreClassModel
::
getInstance
();
$return
=
$storeDAO
->
save
(
array
(
'store_state'
=>
\Our\ApiConst
::
zero
,
'store_close_info'
=>
$reason
),
array
(
'store_id'
=>
$storeInfo
[
'store_id'
]));
if
(
$return
!==
false
)
{
$storeDAO
->
delStoreInfoCache
(
$storeInfo
[
'store_id'
]);
$memberDAO
->
saveInfo
(
array
(
'store_id'
=>
\Our\ApiConst
::
zero
),
$storeInfo
[
'member_id'
]);
\Business\Store\StoreServiceModel
::
getInstance
()
->
deleteStoreAndStoreClassCacheByCitycode
(
$storeInfo
[
'store_citycode'
]);
\DAO\QmStoreClassModel
::
getInstance
()
->
delStoreSignClassesCache
(
$storeInfo
[
'store_citycode'
],
$storeInfo
[
'store_id'
]);
\DAO\FavoritesStoreModel
::
getInstance
()
->
delMyFavoritesStoreByStoreId
(
$storeInfo
[
'store_id'
]);
$list
=
$qmStoreClassDAO
->
selectByWhere
(
array
(
'store_id'
=>
$storeInfo
[
'store_id'
],
'is_charged'
=>
1
),
'distinct(gc_parent_id) as gcId'
);
if
(
$list
)
{
foreach
(
$list
as
$v
)
{
$this
->
deleteQmStoreClassByGcParentId
(
$v
[
'gcId'
]);
}
}
}
}
/**
*/
...
...
application/models/Business/User/MemberService.php
View file @
97b83af7
...
...
@@ -1170,5 +1170,47 @@ class MemberServiceModel extends \Business\AbstractModel
}
}
}
public
function
hasAddInviter
(
$memberId
)
{
$sess
=
\Yaf\Session
::
getInstance
();
$authInfo
=
$sess
->
get
(
'wxAuthInfo'
);
$openId
=
$authInfo
[
'openid'
];
$result
=
\DAO\Store\QmStoreInvite
::
getInstance
()
->
getQmStoreInviteOne
(
array
(
'invite_wxappopenid'
=>
$openId
));
return
array
(
'hasAddInviter'
=>
$result
?
1
:
0
);
}
public
function
addInviter
(
$param
,
$memberId
)
{
$code
=
$param
[
'code'
];
$inviterTel
=
trim
(
$param
[
'inviterTel'
]);
$applicantTel
=
trim
(
$param
[
'applicantTel'
]);
$validData
[
'key'
]
=
$param
[
'key'
];
$validData
[
'messageType'
]
=
ApiConst
::
messageTypeOpenStoreInvite
;
$validData
[
'mobile'
]
=
$param
[
'applicantTel'
];
$validData
[
'code'
]
=
$param
[
'code'
];
$shortMessageDao
=
\DAO\ShortMessageModel
::
getInstance
();
$shortMessageDao
->
validCode
(
$validData
);
if
(
$inviterTel
==
$applicantTel
)
{
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
StoreInviterNotBeSelf
);
}
if
(
$inviterTel
)
{
$result
=
\DAO\MemberModel
::
getInstance
(
\Our\DbNameConst
::
masterDBConnectName
)
->
getOneByWhereWithField
(
" (store_id>0 or is_inviter=1) and member_mobile ='"
.
$inviterTel
.
"'"
,
'member_id'
);
if
(
!
$result
)
{
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
isNotStoreInviter
);
}
}
else
{
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
isNotStoreInviter
);
}
$sess
=
\Yaf\Session
::
getInstance
();
$authInfo
=
$sess
->
get
(
'wxAuthInfo'
);
$openId
=
$authInfo
[
'openid'
];
if
(
$openId
)
{
$QmStoreInviteDAO
=
\DAO\Store\QmStoreInvite
::
getInstance
(
\Our\DbNameConst
::
masterDBConnectName
);
$result
=
$QmStoreInviteDAO
->
getQmStoreInviteOne
(
array
(
'invite_wxappopenid'
=>
$openId
));
if
(
!
$result
)
{
$result
=
$QmStoreInviteDAO
->
addQmStoreInvite
(
array
(
'invite_code'
=>
$inviterTel
,
'invite_mobile'
=>
$applicantTel
,
'invite_time'
=>
TIMESTAMP
,
'invite_wxappopenid'
=>
$openId
));
if
(
$result
)
{
return
true
;
}
}
}
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
commonError
);
}
}
application/models/Business/User/SalespersonService.php
View file @
97b83af7
...
...
@@ -283,9 +283,6 @@ class SalespersonServiceModel extends \Business\AbstractModel
}
private
function
validSaleSmsCode
(
$where
){
//验证手机号码
if
(
$where
[
'code'
]
==
'666666'
&&
(
APP_ENV
==
'test'
||
APP_ENV
==
'develop'
)){
return
true
;
}
$validData
[
'key'
]
=
$where
[
'key'
];
$validData
[
'messageType'
]
=
ApiConst
::
messageTypeSeller
;
$validData
[
'mobile'
]
=
$where
[
'mobile'
];
...
...
application/models/Business/User/ShortMessageService.php
100755 → 100644
View file @
97b83af7
...
...
@@ -34,6 +34,10 @@ class ShortMessageServiceModel extends \Business\AbstractModel {
}
else
if
(
\Our\ApiConst
::
messageTypeSeller
==
$messageType
){
$memberDao
->
checkSaleMobile
(
$where
,
$memberId
);
}
else
if
(
\Our\ApiConst
::
messageTypeOpenStoreInvite
==
$messageType
)
{
if
(
!
$memberId
)
{
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
NoLoginOpenStoreInvite
);
}
}
$shortMessageDao
=
\DAO\ShortMessageModel
::
getInstance
();
$result
=
$shortMessageDao
->
sendSms
(
$where
);
...
...
application/models/DAO/Member.php
View file @
97b83af7
...
...
@@ -130,8 +130,10 @@ class MemberModel extends \DAO\AbstractModel
if
(
isset
(
$member
[
'member_passwd'
])
&&
$member
[
'member_passwd'
]){
unset
(
$member
[
'member_passwd'
]);
}
foreach
(
$member
as
$key
=>
$val
){
$memberDb0Redis
->
tableHSet
(
$memberId
,
$key
,
$val
);
if
(
$memberDb0Redis
->
tableExists
(
$memberId
))
{
foreach
(
$member
as
$key
=>
$val
){
$memberDb0Redis
->
tableHSet
(
$memberId
,
$key
,
$val
);
}
}
}
return
$result
;
...
...
application/models/DAO/QmStoreClass.php
View file @
97b83af7
...
...
@@ -34,10 +34,9 @@ class QmStoreClassModel extends \DAO\AbstractModel{
$where
=
$this
->
db
->
getSqlWhereByArray
(
$where
);
}
if
(
$limit
){
$result
=
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
limit
(
$limit
[
0
],
$limit
[
1
])
->
fetchAll
();
}
else
{
$result
=
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
fetchAll
();
$this
->
db
->
limit
(
$limit
[
0
],
$limit
[
1
]);
}
$result
=
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
fetchAll
();
return
$result
;
}
...
...
application/models/DAO/Store.php
View file @
97b83af7
...
...
@@ -424,8 +424,9 @@ class StoreModel extends \DAO\AbstractModel
public
function
delStoreInfoCache
(
$storeId
)
{
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db6\StoreRedisModel
::
getInstance
(),
array
(
&
$this
,
'getInfoById'
),
array
(
$storeId
),
array
(
$storeId
));
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db6\StoreRedisModel
::
getInstance
(),
array
(
&
$this
,
'getInfoById'
),
array
(),
array
(
$storeId
));
}
/**
* 店铺分享图片
*
...
...
application/models/DAO/Store/QmStoreInvite.php
0 → 100644
View file @
97b83af7
<?php
namespace
DAO\Store
;
class
QmStoreInvite
extends
\DAO\AbstractModel
{
/**
* 表名
*
* @var string
*/
protected
$_tableName
=
'han_qm_store_invite'
;
/**
* 主键
*
* @var string
*/
protected
$_primaryKey
=
'invite_id'
;
public
function
init
()
{
}
public
function
getQmStoreInviteOne
(
$where
,
$field
=
'*'
)
{
$this
->
setDb
(
$this
->
dbName
);
return
$this
->
db
->
select
(
$field
)
->
where
(
$where
)
->
fetchOne
();
}
public
function
addQmStoreInvite
(
$data
)
{
$this
->
setDb
(
\Our\DbNameConst
::
masterDBConnectName
);
return
$this
->
db
->
insert
(
$this
->
_tableName
)
->
rows
(
$data
)
->
execute
();
}
/**
* 类实例
*
* @var \DAO\UserModel
*/
private
static
$_instance
=
null
;
/**
* 获取类实例
*
* @return \DAO\UserModel
*/
public
static
function
getInstance
(
$dbName
=
\Our\DbNameConst
::
salveDBConnectName
)
{
if
(
!
(
self
::
$_instance
instanceof
self
))
{
self
::
$_instance
=
new
self
(
$dbName
);
}
return
self
::
$_instance
;
}
}
application/models/DAO/Store/StoreDrainageAmount.php
View file @
97b83af7
...
...
@@ -66,9 +66,18 @@ class StoreDrainageAmountModel extends \DAO\AbstractModel
if
(
$limit
)
{
$this
->
db
->
limit
(
$limit
[
0
],
$limit
[
1
]);
}
if
(
is_array
(
$where
))
{
$where
=
$this
->
db
->
getSqlWhereByArray
(
$where
);
}
$result
=
$this
->
db
->
select
(
$field
)
->
from
(
'han_store'
)
->
join
(
$this
->
_tableName
,
'han_store.store_id = han_store_drainage_amount.store_id'
,
'inner'
)
->
where
(
$where
)
->
fetchAll
();
return
$result
;
}
public
function
editDrainage
(
$where
,
$data
)
{
$this
->
setDb
(
\Our\DbNameConst
::
masterDBConnectName
);
$result
=
$this
->
db
->
update
(
$this
->
_tableName
)
->
rows
(
$data
)
->
where
(
$where
)
->
execute
();
return
$result
;
}
/**
* 类实例
*
...
...
application/models/Error/CodeConfig.php
View file @
97b83af7
...
...
@@ -453,6 +453,10 @@ const updateGoodsStorageFail=300150;
//数据库错误
const
databaseError
=
190001
;
//开店邀请
const
NoLoginOpenStoreInvite
=
200001
;
const
StoreInviterNotBeSelf
=
200002
;
const
isNotStoreInviter
=
200003
;
/**
* 获取错误码配置
*/
...
...
@@ -876,6 +880,9 @@ const updateGoodsStorageFail=300150;
self
::
registerMemberInfoFailed
=>
'注册更新用户信息失败'
,
self
::
authMemberExistMobile
=>
'该授权用户已经绑定手机号码'
,
self
::
databaseError
=>
'数据库执行失败'
,
self
::
NoLoginOpenStoreInvite
=>
'未登录'
,
self
::
StoreInviterNotBeSelf
=>
'邀请人号码不能跟申请人相同'
,
self
::
isNotStoreInviter
=>
'该号码还不是邀请人'
,
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment