package com.bohuikeji.delivery.backstage.controller.admin;

import com.bohuikeji.delivery.backstage.service.ITOrderArrearsService;
import com.bohuikeji.frame.module.admin.annotation.InitLog;
import com.bohuikeji.frame.module.admin.base.ControllerBase;
import com.bohuikeji.frame.module.admin.entity.back.APIEntity;
import com.bohuikeji.frame.module.admin.utils.YiXunGmsUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 订单
 *
 * @author 10552
 */
@RequiredArgsConstructor
@Slf4j
@RestController
@RequestMapping("/order/arrears")
public class OrderArrearsController extends ControllerBase {
    final ITOrderArrearsService arrearsService;


    @InitLog("查询催缴记录")
    @GetMapping("/get/record")
    public APIEntity getEditStatus(Integer id) {
        return APIEntity.success();
    }

    @InitLog("发送催缴短信")
    @GetMapping("/get/send/msg")
    public APIEntity sendMsg(Integer id,String phone,String text) {
        if (YiXunGmsUtils.sendTxt(phone,text)){
            arrearsService.insertRecord(id,phone,text);
            return APIEntity.success();
        }
        return APIEntity.fail();
    }
}
