package com.yh.saas.plugin.yiliangyiyun.controller;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.yh.saas.plugin.yiliangyiyun.entity.AppVersion;
import com.yh.saas.plugin.yiliangyiyun.entity.CommonUser;
import com.yh.saas.plugin.yiliangyiyun.service.IAppVersionService;
import com.yh.saas.plugin.yiliangyiyun.service.ICommonUserService;
import com.yh.saas.plugin.yiliangyiyun.util.GeTuiUtils;
import org.apache.commons.codec.digest.Md5Crypt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * APP版本管理 前端控制器
 * </p>
 *
 * @author Gongdc
 * @since 2021-08-23
 */
@RestController
@RequestMapping("/appVersion")
public class AppVersionController {
    @Autowired
    private IAppVersionService appVersionService;
    @Autowired
    private ICommonUserService commonUserService;
    @Autowired
    private GeTuiUtils geTuiUtils;
    /**
     * 查看版本信息
     */
    @GetMapping("/selectInfo")
    public AppVersion selectInfo(@RequestParam String appid, String version, String imei) {
        return appVersionService.selectInfo(appid,version,imei);
    }
    /**
     * 推送测试
     */
    @GetMapping("/test")
    public void test() {
        geTuiUtils.pushByCid("推送测试","推送测试内容","84f62127b7384dcdbaeaddfe460329fc");
//       List<CommonUser> list =   commonUserService.selectList(new EntityWrapper<>());
//       for(CommonUser commonUser:list){
//           commonUser.setPassword(Md5Crypt.md5Crypt("123456".getBytes(), "$1$" + commonUser.getPhone().substring(0, 7)));
//       }
//       commonUserService.updateBatchById(list);
    }

}

