<?php
/**
 *
 * @author：llbjj
 * @DateTime：2022/5/6 10:57
 * @Description：
 *
 */

namespace Application\Service\DB\Project;

use Interop\Container\ContainerInterface;

class Msginfo extends \Application\Service\DB\AbstractDb
{
    public function __construct($dbAdapter, ContainerInterface $container)
    {
        $this->tableName = 'yikeen_project_msginfo';
        parent::__construct($dbAdapter, $container);
    }

    /**
     * Notes: 保存当天发信内容
     * User: lltyy
     * DateTime: 2024/11/28 10:05
     *
     * @param array $params
     */
    public function saveSendMesHandleData(array $params)
    {
        $now_date = isset($params['now_date']) && $params['now_date'] != '' ? $params['now_date'] : date('Y-m-d');
        $send_datas = isset($params['data']) && !empty($params['data']) ? $params['data'] : [];
        if (!empty($send_datas)) {
            foreach ($send_datas as $send_user => $send_infos) {
                foreach ($send_infos as $send_item => $send_info_arr) {
                    foreach ($send_info_arr as $send_itemsig => $send_info) {
                        $save_data = $send_info;
                        $save_data['userid'] = $send_user;
                        $save_data['now_date'] = $now_date;
                        $save_data['create_user_id'] = 0;
                        $this->save($save_data);
                        unset($save_data);
                        unset($send_info_arr[$send_itemsig]);
                        unset($send_infos[$send_item][$send_itemsig]);
                        unset($send_datas[$send_user][$send_item][$send_itemsig]);
                    }
                    unset($send_infos[$send_item]);
                    unset($send_datas[$send_user][$send_item]);
                }
                unset($send_datas[$send_user]);
            }
        }
        unset($send_datas);
    }

}