私域操盘手 - 调整账号权重计算规则,引入 WechatCustomer

This commit is contained in:
柳清爽
2025-05-15 16:14:48 +08:00
parent 2fec134ad7
commit b55f999de8
4 changed files with 98 additions and 29 deletions

View File

@@ -2,6 +2,7 @@
namespace AccountWeight\UnitWeight;
use app\common\model\WechatCustomer as WechatCustomerModel;
use library\interfaces\WechatAccountWeightResultSet as WechatAccountWeightResultSetInterface;
class ActivityWeigth implements WechatAccountWeightResultSetInterface
@@ -16,7 +17,15 @@ class ActivityWeigth implements WechatAccountWeightResultSetInterface
*/
private function getChatTimesPerDay(string $wechatId): int
{
return mt_rand(0, 100);
$activity = (string)WechatCustomerModel::where([
'wechatId' => $wechatId,
]
)
->value('activity');
$activity = json_decode($activity, true);
return $activity->yesterdayMsgCount ?? 0;
}
/**