Batch Change fan group

Source: Internet
Author: User
Tags openid

1: Full selection and reverse selection

Select All

type="checkbox" id="selectAll">

List:

type="checkbox" name="ids"value="‘+data.openid+‘" >‘

JS Effect:

//Select all, reverse selection$( function() {$("#selectAll"). Click ( function() {$("Input[name= ' IDs ']"). Prop ("Checked", This. checked);    }); $("Input[name= ' IDs ']"). Click ( function() {      var$ids = $ ("Input[name= ' IDs ']"); $("#selectAll"). Prop ("Checked", $ids. Length = = $ids. Filter (": Checked"). length?true:false);  }); }); function _bindcheckboxclick(){$("Input[name= ' IDs ']"). Click ( function() {          var$ids = $ ("Input[name= ' IDs ']"); $("#selectAll"). Prop ("Checked", $ids. Length = = $ids. Filter (": Checked"). length?true:false); });}

Modify:

 function batchmove(){            //Get the latest group ID             varWxgroupid = $ ("#groupBathList"). Val ();//Get the selected fan collection             varOpenidarr =New Array; $("input[type=checkbox][name=ids]:checked"). each ( function(i){Openidarr[i] = $ ( This). Val (); });//Convert a comma-separated string             varOpenids = Openidarr.join (', ');//Submit action                    varURL ="<%=basePath%>"; url = url +"Fan/op/batchupdatefan.shtml";varparams = {};                    Params.openids = Openids;                    Params.wxgroupid = Wxgroupid; $.post (URL, params, function (data) {                                if(Data.success = =1) {                                    $(' #errmsg '). Calert (' alert ',"modified successfully!");                                Query (); }                     },"JSON"); }

Background processing:

 Public StringBatchupdatefan () {try {Map = NewHashMap<String, Object>();Map.Put"Success",1);//Public number ID that needs to be synchronizedWxaccount wxaccount_session=Getsessuser ().Getwxaccount_session ();StringAccess_token=Wxconstant.Getrealaccesstoken (wxaccount_session.Getaccountappid ());if(StringUtils.Isnotnull (Openids)) {List<String>Openidlist=StringUtils.Stringtoliststr (Openids,",");if(openidlist!= NULL &&Openidlist.Size ()>0) {for (Stringopenid:openidlist) {Fan fan= NewFan (); Fan.Setopenid (OpenID); Fan=Fanservice.Getfan (fan);if(Fan!= NULL) {Fan.Setwxgroupid (Integer.parseint (Wxgroupid)); Fanservice.Updatefan (fan); }                    }                }//Synchronizing user groups                StringBatchmoveusertogroupurl=Wxconstant.Getbatchmoveusertogroupurl (Access_token); Jsonobject Jsonobject= NewJsonobject (); Jsonobject.Put"Openid_list", openidlist); Httputils.Post (Batchmoveusertogroupurl, G.ToJson (Jsonobject)); }} catch (Exception e) {E.Printstacktrace ();Map.Put"Success",0);Map.Put"ErrMsg"E.GetMessage ()); }return "Toresult"; }

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Batch Change fan group

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.