

/*=============================================================================================
	author:ZhaoJun
	version:1.2
	email:2732810281@qq.com
=============================================================================================*/

 
//严格模式
/*-------------------------------------------------------------------------------------------*/	
    'use strict';
/*-------------------------------------------------------------------------------------------*/
    
// 用户设备
/*-------------------------------------------------------------------------------------------*/	
    class reply
    {
        addToken(req)
        {
            let doc = 
            {                    
                base:{group:"用户-文章回复",descript:"添加文章回复",requestMethod:"post"},
                service:{path:"/sql",method:"insert",db:"main"},
                requestParam:  
                {                       
                    articleid:{...$DbMysqlr.su_article_reply.articleid,field:true},                         
                    content:{...$DbMysqlr.su_article_reply.content,field:true}, 
                    image:{...$DbMysqlr.su_article_reply.image,field:true}, 
                },                  
                fun(param)    
                {        
                    param.field.time=Date.now()/1000
                    param.field.userid=req.token.id
                    param.table='su_article_reply'
                } 
            };
 
            this.$doc=doc
        }

        addReplyToken(req)
        {
            let doc = 
            {                    
                base:{group:"用户-文章回复",descript:"添加文章回复的回复",requestMethod:"post"},
                service:{path:"/sql",method:"update",db:"main"},
                requestParam:  
                {                       
                    id:{...$DbMysqlr.su_article_reply.id,where:true},
                    articleid:{...$DbMysqlr.su_article_reply.articleid,where:true},                         
                    reply:{...$DbMysqlr.su_article_reply.content,field:true}, 
                    image:{...$DbMysqlr.su_article_reply.image,field:true}, 
                },                  
                fun(param)    
                {       
                    param.field.time=Date.now()/1000
                    param.field.userid=req.token.id
                    param.table='su_article_reply'
                } 
            };
 
            this.$doc=doc
        }

        delToken(req)
        {
            let doc = 
            {                    
                base:{group:"用户-文章回复",descript:"删除文章回复",requestMethod:"post"},
                service:{path:"/sql",method:"delete",db:"main"},
                requestParam:  
                {
                    id:{...$DbMysqlr.su_article_reply.id,field:true}, 
                },                  
                fun(param)    
                {       
                    param.where.userid=req.token.id
                    param.table='su_article_reply'
                } 
            };
 
            this.$doc=doc
        }

        getToken(req)
        {
            let doc = 
            {                    
                base:{group:"用户-文章回复",descript:"得到文章回复",requestMethod:"post"},
                service:{path:"/sql",method:"select",db:"main"},
                requestParam:  
                {
                    articleid:{...$DbMysqlr.su_article_reply.articleid,field:true}, 
                },                  
                fun(param)    
                {       
                    param.page=req.post.page
                    param.pageNext=15
                    param.table='su_article_reply'
                } 
            };
 
            this.$doc=doc
        }


    }
/*-------------------------------------------------------------------------------------------*/    
module.exports=reply;