// +---------------------------------------------------------------------- declare (strict_types=1); namespace app\timer\model\groupon; use app\common\model\groupon\TaskUsers as TaskUsersModel; /** * 拼团拼单成员模型 * Class TaskUsers * @package app\timer\model\groupon */ class TaskUsers extends TaskUsersModel { /** * 批量加入机器人成员 * @param array $robotIds * @param $task * @param $storeId * @return bool */ public static function mockJoin(array $robotIds, $task, $storeId): bool { // 批量加入拼团 $data = []; foreach ($robotIds as $robotId) { $data[] = [ 'task_id' => $task['task_id'], 'is_robot' => 1, 'robot_id' => $robotId, 'store_id' => $storeId, ]; } !empty($data) && (new static)->addAll($data); return true; } }